Skip to content

Commit

Permalink
Fix measure search filter accordion button text and aria label
Browse files Browse the repository at this point in the history
  • Loading branch information
dalecannon committed Mar 22, 2024
1 parent 34b0846 commit 1f91ca0
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions common/static/common/js/openCloseAccordion.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
// TODO: adjust the pathname filter to account for all objects search/filter pages
const initOpenCloseAccordionSection = () => {
document.addEventListener('DOMContentLoaded', function() {

let expandedSection = document.getElementById('accordion-open-close-section')
let pathname = window.location.pathname
if(expandedSection){
if (!pathname.includes('search')){
expandedSection.classList.remove('govuk-accordion__section--expanded');
}
}
document.addEventListener("DOMContentLoaded", function () {
let button = document.querySelector(".govuk-accordion__open-all");
let expandedSection = document.getElementById("accordion-open-close-section");
let pathname = window.location.pathname;
if (expandedSection) {
if (!pathname.includes('search')) {
button.innerHTML = "Open all";
button.setAttribute("aria-expanded", "false");
expandedSection.classList.remove('govuk-accordion__section--expanded');
}
}
)
}
});
};

export default initOpenCloseAccordionSection;
export default initOpenCloseAccordionSection;

0 comments on commit 1f91ca0

Please sign in to comment.