FIX: consistent narrow desktop width (#19232)

- use client rect instead of innerWidth to determine if screen is narrow
- disable _animate when exit mobile/narrow view
This commit is contained in:
Krzysztof Kotlarek 2022-11-29 11:03:54 +11:00 committed by GitHub
parent 7c75b5b100
commit 787655e276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -367,9 +367,7 @@ const SiteHeaderComponent = MountWidget.extend(
const menuPanels = document.querySelectorAll(".menu-panel"); const menuPanels = document.querySelectorAll(".menu-panel");
if (menuPanels.length === 0) { if (menuPanels.length === 0) {
if (this.site.mobileView || this.site.narrowDesktopView) { this._animate = this.site.mobileView || this.site.narrowDesktopView;
this._animate = true;
}
return; return;
} }

View File

@ -5,7 +5,8 @@ const NarrowDesktop = {
init() { init() {
this.narrowDesktopView = this.narrowDesktopView =
narrowDesktopForced || this.isNarrowDesktopView(window.innerWidth); narrowDesktopForced ||
this.isNarrowDesktopView(document.body.getBoundingClientRect().width);
}, },
isNarrowDesktopView(width) { isNarrowDesktopView(width) {