From 0236edae5366845f5871e9ddd3db1da087f1f1a2 Mon Sep 17 00:00:00 2001 From: EGRrqq Date: Fri, 2 Feb 2024 04:02:56 -0500 Subject: [PATCH] feat(ui): toggle aria-hidden attribute on dropdown el --- src/index.ts | 1 + src/uiController/menu/dropdown.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/index.ts b/src/index.ts index 4a43134..83fe588 100644 --- a/src/index.ts +++ b/src/index.ts @@ -69,6 +69,7 @@ if (boardController.ctx) { switchBtnController.onClick(() => { dropdownController.toggleIsOpen(); dropdownController.toggleClass(toggleClass); + dropdownController.toggleAriaHidden(); }); saveBtnController.onClick(() => { diff --git a/src/uiController/menu/dropdown.ts b/src/uiController/menu/dropdown.ts index 1f21c14..888b48f 100644 --- a/src/uiController/menu/dropdown.ts +++ b/src/uiController/menu/dropdown.ts @@ -1,6 +1,7 @@ interface IDropdown { toggleIsOpen: () => void; toggleClass: (cssClass: string) => void; + toggleAriaHidden: () => void; } export class DropdownController implements IDropdown { @@ -41,4 +42,17 @@ export class DropdownController implements IDropdown { break; } } + + toggleAriaHidden() { + switch (this.#isOpen) { + case "true": + this.#dropdownEl.ariaHidden = "false"; + break; + case "false": + this.#dropdownEl.ariaHidden = "true"; + break; + default: + break; + } + } }