PageSourceSearch

https://moreno-valley.ca.us/js/wcag.js

js moreno-valley.ca.us collected 2026-10-02 10:04:39 UTC 1,905 bytes, 47 lines download raw bytes

1// Standalone disclosure behaviour for #accordion1 on pages that do NOT load
2// js/mv-init.js (~800 of them). Where both files load, mv-init.js drives the
3// awsAccordion plugin and patches the same ARIA — running both put two toggle
4// handlers on every heading, so each Enter press opened the panel and then
5// immediately closed it again, leaving the accordion keyboard-inoperable.
6// mv-init.js stamps data-accordion-enhanced once it has taken ownership.
7document.addEventListener('DOMContentLoaded', function () {
8  var accordion = document.getElementById('accordion1');
9  if (accordion && accordion.hasAttribute('data-accordion-enhanced')) return;
10
11  var accordionItems = document.querySelectorAll('#accordion1 > ul > li');
12  accordionItems.forEach(function (item, index) {
13    var trigger = item.querySelector('h3');
14    var panel = item.querySelector('div');
15    var panelId = 'accordion-panel-' + index;
16    var triggerId = 'accordion-trigger-' + index;
17
18    trigger.setAttribute('id', triggerId);
19    trigger.setAttribute('role', 'button');
20    trigger.setAttribute('tabindex', '0');
21    trigger.setAttribute('aria-expanded', 'false');
22    trigger.setAttribute('aria-controls', panelId);
23
24    panel.setAttribute('id', panelId);
25    panel.setAttribute('role', 'region');
26    panel.setAttribute('aria-labelledby', triggerId);
27    panel.setAttribute('hidden', '');
28
29    function togglePanel() {
30      var expanded = trigger.getAttribute('aria-expanded') === 'true';
31      trigger.setAttribute('aria-expanded', String(!expanded));
32      if (expanded) {
33        panel.setAttribute('hidden', '');
34      } else {
35        panel.removeAttribute('hidden');
36      }
37    }
38
39    trigger.addEventListener('click', togglePanel);
40    trigger.addEventListener('keydown', function (e) {
41      if (e.key === 'Enter' || e.key === ' ') {
42        e.preventDefault();
43        togglePanel();
44      }
45    });
46  });
47});

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.