From 1399dbc05b04b31ef03fff3c1c2c3cea411325ce Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 14 May 2022 19:01:48 +0200 Subject: [PATCH] Expand the active menu item by default --- ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts | 9 +++++++++ .../files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts b/ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts index 1a429f9c13..ffd827d66b 100644 --- a/ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts +++ b/ts/WoltLabSuite/Core/Ui/Page/Menu/Main.ts @@ -116,6 +116,15 @@ export class PageMenuMain implements PageMenuProvider { button?.setAttribute("aria-expanded", "true"); } } + + // Expand the current item, if it contains menu items itself. + const button = activeMenuItem.nextElementSibling as HTMLElement | null; + if (button) { + button.setAttribute("aria-expanded", "true"); + + const itemList = button.nextElementSibling as HTMLElement; + itemList.hidden = false; + } } } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js index 4ebc31ecac..3e050ab660 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Menu/Main.js @@ -87,6 +87,13 @@ define(["require", "exports", "tslib", "./Container", "../../../Language", "../. button === null || button === void 0 ? void 0 : button.setAttribute("aria-expanded", "true"); } } + // Expand the current item, if it contains menu items itself. + const button = activeMenuItem.nextElementSibling; + if (button) { + button.setAttribute("aria-expanded", "true"); + const itemList = button.nextElementSibling; + itemList.hidden = false; + } } } buildFooterMenu() { -- 2.20.1