From: Alexander Ebert Date: Fri, 4 Aug 2023 11:32:02 +0000 (+0200) Subject: Update the `aria-expanded` attribute when implicitly closing drop-down menus X-Git-Tag: 6.0.0_Beta_1~14^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c1f52f9c2b96f0bfaeec4c813f7548f9c3a694b2;p=GitHub%2FWoltLab%2FWCF.git Update the `aria-expanded` attribute when implicitly closing drop-down menus Fixes #5553 --- 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"); } });