1export default function accordionMobileMenu() { 2 const mainMenu = document.querySelector(".menu-principal") 3 let menuItems; 4 if (mainMenu) { 5 menuItems = mainMenu.querySelectorAll(".menu > .menu-item"); 6 } 7 if (menuItems) { 8 menuItems.forEach((item) => { 9 let expanded = false; 10 const subMenu = item.querySelector(".sub-menu"); 11 const itemAfter = window.getComputedStyle(item, ":after"); 12 // RGAA 13 item.setAttribute("aria-expanded", expanded); 14 item.setAttribute("aria-controls", item.id + "-panel"); 15 16 if (subMenu) { 17 subMenu.id = item.id + "-panel"; 18 } 19 20 if (subMenu) { 21 item.addEventListener("click", () => { 22 item.classList.toggle("sub-menu-opened"); 23 subMenu.classList.toggle("opened"); 24 // RGAA 25 expanded = !expanded; 26 item.setAttribute("aria-expanded", expanded); 27 }); 28 29 /// RGAA 30 subMenu.querySelectorAll("li").forEach((subItem) => { 31 const link = subItem.querySelector("a"); 32 link.tabIndex = 0; 33 if (subItem.classList.contains("active")) { 34 link.setAttribute("aria-current", true); 35 } 36 }); 37 } 38 }); 39 } 40}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.