diff --git a/app/assets/javascripts/discourse/app/components/site-header.js b/app/assets/javascripts/discourse/app/components/site-header.js index 32045dec662..2be7047b78d 100644 --- a/app/assets/javascripts/discourse/app/components/site-header.js +++ b/app/assets/javascripts/discourse/app/components/site-header.js @@ -183,9 +183,13 @@ const SiteHeaderComponent = MountWidget.extend( } const offset = info.offset(); - const headerRect = header.getBoundingClientRect(), - headerOffset = headerRect.top + headerRect.height, - doc = document.documentElement; + const headerRect = header.getBoundingClientRect(); + const doc = document.documentElement; + let headerOffset = headerRect.top + headerRect.height; + + if (window.scrollY < 0) { + headerOffset -= window.scrollY; + } const newValue = `${headerOffset}px`; if (newValue !== this.currentHeaderOffsetValue) {