diff options
author | Justin Boyson <jboyson@gitlab.com> | 2019-05-30 15:54:39 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-05-30 15:54:39 +0000 |
commit | fc0d63806242ad5e9d3c48ffd4656b1e7eb82e40 (patch) | |
tree | 4e28726a0773b0cd1a8685888521f84882129019 | |
parent | 62ac4b2485a774803eb6812fadb95c589438bd95 (diff) | |
download | gitlab-ce-fc0d63806242ad5e9d3c48ffd4656b1e7eb82e40.tar.gz |
Add offset adjust to fix line position
Added offset adjustment for diff file header and version menus
container divs. This should make the linked line be visible.
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 10 | ||||
-rw-r--r-- | changelogs/unreleased/47846-position-is-off-when-visiting-files-with-anchors.yml | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index b236daff1e0..cc5e12aa467 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -94,6 +94,8 @@ export const handleLocationHash = () => { const fixedNav = document.querySelector('.navbar-gitlab'); const performanceBar = document.querySelector('#js-peek'); const topPadding = 8; + const diffFileHeader = document.querySelector('.js-file-title'); + const versionMenusContainer = document.querySelector('.mr-version-menus-container'); let adjustment = 0; if (fixedNav) adjustment -= fixedNav.offsetHeight; @@ -114,6 +116,14 @@ export const handleLocationHash = () => { adjustment -= performanceBar.offsetHeight; } + if (diffFileHeader) { + adjustment -= diffFileHeader.offsetHeight; + } + + if (versionMenusContainer) { + adjustment -= versionMenusContainer.offsetHeight; + } + if (isInMRPage()) { adjustment -= topPadding; } diff --git a/changelogs/unreleased/47846-position-is-off-when-visiting-files-with-anchors.yml b/changelogs/unreleased/47846-position-is-off-when-visiting-files-with-anchors.yml new file mode 100644 index 00000000000..21dc170f1ca --- /dev/null +++ b/changelogs/unreleased/47846-position-is-off-when-visiting-files-with-anchors.yml @@ -0,0 +1,5 @@ +--- +title: Resolve Position is off when visiting files with anchors +merge_request: 28913 +author: +type: fixed |