Skip to content

Commit

Permalink
feat(ui): toggle aria-hidden attribute on dropdown el
Browse files Browse the repository at this point in the history
  • Loading branch information
EGRrqq committed Feb 2, 2024
1 parent 5b8dce5 commit 0236eda
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ if (boardController.ctx) {
switchBtnController.onClick(() => {
dropdownController.toggleIsOpen();
dropdownController.toggleClass(toggleClass);
dropdownController.toggleAriaHidden();
});

saveBtnController.onClick(() => {
Expand Down
14 changes: 14 additions & 0 deletions src/uiController/menu/dropdown.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
interface IDropdown {
toggleIsOpen: () => void;
toggleClass: (cssClass: string) => void;
toggleAriaHidden: () => void;
}

export class DropdownController implements IDropdown {
Expand Down Expand Up @@ -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;
}
}
}

0 comments on commit 0236eda

Please sign in to comment.