blob: 33839894c884b28e527ca0a79e00d18da487936e [file] [log] [blame]
function registerHeaderListeners(){const e=document.querySelector(".js-header"),r=document.querySelectorAll(".js-headerMenuButton");r.forEach(t=>{t.addEventListener("click",s=>{s.preventDefault(),e?.classList.toggle("is-active"),t.setAttribute("aria-expanded",String(e?.classList.contains("is-active")))})}),document.querySelector(".js-scrim")?.addEventListener("click",t=>{t.preventDefault(),e?.classList.remove("is-active"),r.forEach(s=>{s.setAttribute("aria-expanded",String(e?.classList.contains("is-active")))})})}function registerSearchFormListeners(){const e=document.querySelector(".js-searchForm"),r=document.querySelector(".js-expandSearch"),c=e?.querySelector("input"),t=document.querySelector(".js-headerLogo"),s=document.querySelector(".js-headerMenuButton");r?.addEventListener("click",()=>{e?.classList.add("go-SearchForm--expanded"),t?.classList.add("go-Header-logo--hidden"),s?.classList.add("go-Header-navOpen--hidden"),c?.focus()}),document?.addEventListener("click",n=>{e?.contains(n.target)||(e?.classList.remove("go-SearchForm--expanded"),t?.classList.remove("go-Header-logo--hidden"),s?.classList.remove("go-Header-navOpen--hidden"))})}registerHeaderListeners(),registerSearchFormListeners();
//# sourceMappingURL=header.js.map