From c1f52f9c2b96f0bfaeec4c813f7548f9c3a694b2 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 4 Aug 2023 13:32:02 +0200 Subject: [PATCH] Update the `aria-expanded` attribute when implicitly closing drop-down menus Fixes #5553 --- ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts | 5 +++++ .../install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts b/ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts index 41e94ad829..77fab99ff3 100644 --- a/ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts +++ b/ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts @@ -605,6 +605,11 @@ const UiDropdownSimple = { dropdown.classList.remove("dropdownOpen"); _menus.get(containerId)!.classList.remove("dropdownOpen"); + const button = dropdown.querySelector(".dropdownToggle"); + if (button) { + button.setAttribute("aria-expanded", "false"); + } + notifyCallbacks(containerId, "close"); } }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js index 6baafd662d..51dc008c73 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js @@ -503,6 +503,10 @@ define(["require", "exports", "tslib", "../../CallbackList", "../../Core", "../. if (dropdown.classList.contains("dropdownOpen")) { dropdown.classList.remove("dropdownOpen"); _menus.get(containerId).classList.remove("dropdownOpen"); + const button = dropdown.querySelector(".dropdownToggle"); + if (button) { + button.setAttribute("aria-expanded", "false"); + } notifyCallbacks(containerId, "close"); } }); -- 2.20.1