1/** 2 * @file 3 * Accordion interactions for OWSD Map sidebar (Drupal 9/10 behavior). 4 * 5 * Converts vanilla handlers to Drupal behaviors with once(). 6 * - Click on .accordion-toggle toggles its parent .accordion-item and closes siblings. 7 * - Click on .accordion-subitem marks it as active (single-select within the accordion). 8 * - Adds basic ARIA attributes for accessibility. 9 */ 10(function (Drupal, once) { 11 'use strict'; 12 13 14 Drupal.behaviors.owsdAccordion = { 15 attach(context) { 16 // For each accordion container, wire events once 17 once('owsd-accordion', '.accordion-item', context).forEach((accordion) => { 18 const accordionItems = document.querySelectorAll(".accordion-item"); 19 accordionItems.forEach(item => { 20 const toggle = item.querySelector(".accordion-header.filter-btn"); 21 22 if (toggle) { 23 toggle.addEventListener("click", () => { 24 accordionItems.forEach(i => { 25 if (i !== item) i.classList.remove("active"); 26 }); 27 item.classList.toggle("active"); 28 }); 29 } 30 }); 31 }); 32 } 33 }; 34 35})(Drupal, once);
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.