summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib/utils/common_utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/lib/utils/common_utils.js')
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js
index 4ce63d518a6..241488c8039 100644
--- a/app/assets/javascripts/lib/utils/common_utils.js
+++ b/app/assets/javascripts/lib/utils/common_utils.js
@@ -142,7 +142,7 @@ export const getOuterHeight = (selector) => {
const element = document.querySelector(selector);
if (!element) {
- return undefined;
+ return 0;
}
return element.offsetHeight;
@@ -154,6 +154,11 @@ export const contentTop = () => {
() => getOuterHeight('#js-peek'),
() => getOuterHeight('.navbar-gitlab'),
({ desktop }) => {
+ const mrStickyHeader = document.querySelector('.merge-request-sticky-header');
+ if (mrStickyHeader) {
+ return mrStickyHeader.offsetHeight;
+ }
+
const container = document.querySelector('.discussions-counter');
let size = 0;
@@ -161,11 +166,12 @@ export const contentTop = () => {
size = container.offsetHeight;
}
+ size += getOuterHeight('.merge-request-tabs');
+ size += getOuterHeight('.issue-sticky-header.gl-fixed');
+
return size;
},
- () => getOuterHeight('.merge-request-sticky-header, .merge-request-tabs'),
() => getOuterHeight('.js-diff-files-changed'),
- () => getOuterHeight('.issue-sticky-header.gl-fixed'),
({ desktop }) => {
const diffsTabIsActive = window.mrTabs?.currentAction === 'diffs';
let size;