Skip to content

Commit

Permalink
(mobile nav) allowing multiple open accordions at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmavis committed May 1, 2024
1 parent 432b499 commit ebb53d2
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions source/js/components/nav/mobile-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ class NavMobileDropdown extends Accordion {
this.title.classList.add("tw-border-s-4");
}

getOpenSibling() {
return document
.querySelector(`${NavMobileDropdown.selector()} [aria-expanded="true"]`)
?.closest(NavMobileDropdown.selector());
}

bindEvents() {
super.bindEvents();
this.accordion.addEventListener("focus", () => {
Expand Down Expand Up @@ -68,17 +62,6 @@ class NavMobileDropdown extends Accordion {
this.handleWayfindingOpenStyles();
}

let openAccordion = this.getOpenSibling();
if (openAccordion) {
const title = openAccordion.querySelector("[data-accordion-title]");
const chevron = openAccordion.querySelector("[data-accordion-title] img");
const content = openAccordion.querySelector("[data-accordion-content]");
title.setAttribute("aria-expanded", "false");
content.setAttribute("aria-hidden", "true");
chevron.classList.add("tw-rotate-180");
content.style.height = "0";
}

super.open();
this.content.style.height = `${this.content.scrollHeight}px`;
}
Expand Down

0 comments on commit ebb53d2

Please sign in to comment.