summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2019-05-30 15:54:40 +0000
committerMike Greiling <mike@pixelcog.com>2019-05-30 15:54:40 +0000
commitc7e5d046a54cd10145ea81983a7e3ceb94755f79 (patch)
tree4e28726a0773b0cd1a8685888521f84882129019
parent62ac4b2485a774803eb6812fadb95c589438bd95 (diff)
parentfc0d63806242ad5e9d3c48ffd4656b1e7eb82e40 (diff)
downloadgitlab-ce-c7e5d046a54cd10145ea81983a7e3ceb94755f79.tar.gz
Merge branch '47846-position-is-off-when-visiting-files-with-anchors' into 'master'
Resolve "Position is off when visiting files with anchors" Closes #47846 See merge request gitlab-org/gitlab-ce!28913
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js10
-rw-r--r--changelogs/unreleased/47846-position-is-off-when-visiting-files-with-anchors.yml5
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