FIX: --header-offset didn't account for overscroll (#15221)

Fixes miniprofiler badge sliding away from the header when you rubber-band overscroll on the top of the page (in Safari)
This commit is contained in:
Jarek Radosz 2021-12-08 01:40:49 +01:00 committed by GitHub
parent f26b8b448d
commit 301d5657fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -183,9 +183,13 @@ const SiteHeaderComponent = MountWidget.extend(
} }
const offset = info.offset(); const offset = info.offset();
const headerRect = header.getBoundingClientRect(), const headerRect = header.getBoundingClientRect();
headerOffset = headerRect.top + headerRect.height, const doc = document.documentElement;
doc = document.documentElement; let headerOffset = headerRect.top + headerRect.height;
if (window.scrollY < 0) {
headerOffset -= window.scrollY;
}
const newValue = `${headerOffset}px`; const newValue = `${headerOffset}px`;
if (newValue !== this.currentHeaderOffsetValue) { if (newValue !== this.currentHeaderOffsetValue) {