'},closeAccordionItem=e=>{const t=e.querySelector(".accordion__header"),c=e.querySelector(".header__toggle-indicator"),o=e.querySelector(".accordion__panel");e.classList.remove("is-active"),o.style.height=0,t.focus(),t.setAttribute("aria-expanded",!1),c.innerHTML=''},isAccordionOpen=e=>e.classList.contains("is-active");function toggleAccordionItem(){const e=event.target.closest(".accordion__item");e&&!event.target.closest(".accordion__panel")&&(isAccordionOpen(e)?closeAccordionItem(e):openAccordionItem(e))}function recalculateHeight(){accordionItems.filter((e=>e.classList.contains("is-active"))).forEach((e=>{e.querySelector(".accordion__panel").style.height=`${getPanelHeight(e)}px`}))}accordionItems.forEach(((e,t)=>{const c=e.querySelector(".accordion__header"),o=e.querySelector(".accordion__panel");c.setAttribute("id",`accordion-item${t+1}`),o.setAttribute("id",`item${t+1}`),c.setAttribute("aria-controls",`item${t+1}`),o.setAttribute("aria-labelledby",`accordion-item${t+1}`)})),document.addEventListener("keydown",(e=>{const t=e.target.closest(".accordion__item");"Escape"===e.key&&t&&isAccordionOpen(t)&&closeAccordionItem(t)})),document.addEventListener("keydown",(e=>{if(!e.target.closest(".accordion__header"))return;const t=e.target.closest(".accordion__wrapper"),c=e.target.closest(".accordion__item"),o=[...t.querySelectorAll(".accordion__item")],r=o.findIndex((e=>e===c)),{key:i}=e;let n;"ArrowDown"===i&&(n=o[r+1]),"ArrowUp"===i&&(n=o[r-1]),n&&(e.preventDefault(),n.querySelector(".accordion__header").focus())})),window.toggleAccordionItem=toggleAccordionItem,window.onresize=recalculateHeight
© 2024 Qualy Services OÜ - ELBOW 48 PTY LTD ABN 76 648 713 302