Commit fc0d6380 authored by Justin Boyson's avatar Justin Boyson Committed by Mike Greiling

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.
parent 62ac4b24
...@@ -94,6 +94,8 @@ export const handleLocationHash = () => { ...@@ -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 = () => { ...@@ -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;
} }
......
---
title: Resolve Position is off when visiting files with anchors
merge_request: 28913
author:
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment