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.
This commit is contained in:
Justin Boyson 2019-05-30 15:54:39 +00:00 committed by Mike Greiling
parent 62ac4b2485
commit fc0d638062
2 changed files with 15 additions and 0 deletions

View file

@ -94,6 +94,8 @@ export const handleLocationHash = () => {
const fixedNav = document.querySelector('.navbar-gitlab'); const fixedNav = document.querySelector('.navbar-gitlab');
const performanceBar = document.querySelector('#js-peek'); const performanceBar = document.querySelector('#js-peek');
const topPadding = 8; const topPadding = 8;
const diffFileHeader = document.querySelector('.js-file-title');
const versionMenusContainer = document.querySelector('.mr-version-menus-container');
let adjustment = 0; let adjustment = 0;
if (fixedNav) adjustment -= fixedNav.offsetHeight; if (fixedNav) adjustment -= fixedNav.offsetHeight;
@ -114,6 +116,14 @@ export const handleLocationHash = () => {
adjustment -= performanceBar.offsetHeight; adjustment -= performanceBar.offsetHeight;
} }
if (diffFileHeader) {
adjustment -= diffFileHeader.offsetHeight;
}
if (versionMenusContainer) {
adjustment -= versionMenusContainer.offsetHeight;
}
if (isInMRPage()) { if (isInMRPage()) {
adjustment -= topPadding; adjustment -= topPadding;
} }

View file

@ -0,0 +1,5 @@
---
title: Resolve Position is off when visiting files with anchors
merge_request: 28913
author:
type: fixed