/**
* USWDS Footer Behavior
*
* Mirrors official USWDS footer JavaScript behavior exactly
*
* @uswds-source https://github.com/uswds/uswds/blob/develop/packages/usa-footer/src/index.js
* @uswds-version 3.10.0
* @last-synced 2025-10-05
* @sync-status ✅ UP TO DATE
*
* CRITICAL: This file replicates USWDS source code to maintain 100% behavior parity.
* DO NOT add custom logic. ALL changes must come from USWDS source updates.
*/
/**
* Constants from USWDS
*
* SOURCE: index.js (Lines 5-8)
*/
const PREFIX = 'usa';
const SCOPE = `.${PREFIX}-footer--big`;
const NAV = `${SCOPE} nav`;
const BUTTON = `${NAV} .${PREFIX}-footer__primary-link`;
const HIDE_MAX_WIDTH = 480;
/**
* Expands selected footer menu panel, while collapsing others
*
* SOURCE: index.js (Lines 10-23)
*/
function showPanel(this: HTMLElement): void {
if (window.innerWidth < HIDE_MAX_WIDTH) {
const isOpen = this.getAttribute('aria-expanded') === 'true';
const thisFooter = this.closest(SCOPE);
if (!thisFooter) return;
// Close all other menus
thisFooter.querySelectorAll(BUTTON).forEach((button) => {
button.setAttribute('aria-expanded', 'false');
});
this.setAttribute('aria-expanded', String(!isOpen));
}
}
/**
* Swaps the
element for a