Close the mobile navigation drop-down on page scroll
authorAlexander Ebert <ebert@woltlab.com>
Wed, 29 Jun 2022 14:44:30 +0000 (16:44 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 29 Jun 2022 14:44:30 +0000 (16:44 +0200)
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
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js

index 7f53aa4bc260da34613dca6bddf50d5659cf1bbc..a796be806e65879422f567cc740f1903a6b5db66 100644 (file)
@@ -48,6 +48,8 @@ function init(): void {
     initButtonGroupNavigation();
     initMessages();
   });
+
+  document.addEventListener("scroll", () => closeDropdown(), { passive: true });
 }
 
 function initButtonGroupNavigation(): void {
index 126feade120019afe0fad030bf63c75e284b1057..c5bc75ad211e4a0c7d8b675e8cbfec118fa394aa 100644 (file)
@@ -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) => {