From: Alexander Ebert Date: Wed, 29 Jun 2022 14:44:30 +0000 (+0200) Subject: Close the mobile navigation drop-down on page scroll X-Git-Tag: 5.5.0_RC_3~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b91d3b981b03ce96cc7351cea416d5ec6c4ae549;p=GitHub%2FWoltLab%2FWCF.git Close the mobile navigation drop-down on page scroll All drop-down menus are expected to close whenever the page is being scrolled. This is implemented for regular drop-down menus, but this one bypasses the general API. See https://www.woltlab.com/community/thread/296092-fenster-zitieren-inhalt-melden-%C3%BCberlagert-men%C3%BC-mobil/ --- diff --git a/ts/WoltLabSuite/Core/Ui/Mobile.ts b/ts/WoltLabSuite/Core/Ui/Mobile.ts index 7f53aa4bc2..a796be806e 100644 --- a/ts/WoltLabSuite/Core/Ui/Mobile.ts +++ b/ts/WoltLabSuite/Core/Ui/Mobile.ts @@ -48,6 +48,8 @@ function init(): void { initButtonGroupNavigation(); initMessages(); }); + + document.addEventListener("scroll", () => closeDropdown(), { passive: true }); } function initButtonGroupNavigation(): void { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js index 126feade12..c5bc75ad21 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js @@ -43,6 +43,7 @@ define(["require", "exports", "tslib", "focus-trap", "../Core", "../Dom/Change/L initButtonGroupNavigation(); initMessages(); }); + document.addEventListener("scroll", () => closeDropdown(), { passive: true }); } function initButtonGroupNavigation() { document.querySelectorAll(".buttonGroupNavigation").forEach((navigation) => {