From b91d3b981b03ce96cc7351cea416d5ec6c4ae549 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 29 Jun 2022 16:44:30 +0200 Subject: [PATCH] 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/ --- ts/WoltLabSuite/Core/Ui/Mobile.ts | 2 ++ wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js | 1 + 2 files changed, 3 insertions(+) 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) => { -- 2.20.1