blob: ae559bf9566cf75a65ad4d3e2692bc7918907d4e [file] [log] [blame]
/**
* @license
* Copyright 2021 The Go Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/function o(){const e=document.querySelector(".js-header"),n=document.querySelectorAll(".js-headerMenuButton");n.forEach(t=>{t.addEventListener("click",s=>{s.preventDefault(),e==null||e.classList.toggle("is-active"),t.setAttribute("aria-expanded",String(e==null?void 0:e.classList.contains("is-active")))})});const c=document.querySelector(".js-scrim");c==null||c.addEventListener("click",t=>{t.preventDefault(),e==null||e.classList.remove("is-active"),n.forEach(s=>{s.setAttribute("aria-expanded",String(e==null?void 0:e.classList.contains("is-active")))})})}function d(){const e=document.querySelector(".js-searchForm"),n=document.querySelector(".js-expandSearch"),c=e==null?void 0:e.querySelector("input"),t=document.querySelector(".js-headerLogo"),s=document.querySelector(".js-headerMenuButton");n==null||n.addEventListener("click",()=>{e==null||e.classList.add("go-SearchForm--expanded"),t==null||t.classList.add("go-Header-logo--hidden"),s==null||s.classList.add("go-Header-navOpen--hidden"),c==null||c.focus()}),document==null||document.addEventListener("click",i=>{(e==null?void 0:e.contains(i.target))||(e==null||e.classList.remove("go-SearchForm--expanded"),t==null||t.classList.remove("go-Header-logo--hidden"),s==null||s.classList.remove("go-Header-navOpen--hidden"))})}export{o as registerHeaderListeners,d as registerSearchFormListeners};
//# sourceMappingURL=header.js.map