drupal.component.accordion
By rang501@gmail.comv1.0.0WCAG-Compliant Accordion Component for Drupal (SDC + Tailwind)
Create an accessible accordion component implemented as a Drupal module using Drupal Single Directory Components (SDC). The component must meet WCAG 2.2 AA requirements and follow WAI-ARIA Authoring Practices for accordions. Styling must be done using Tailwind CSS utility classes only.
component.ymlitems, allow_multiple, expanded_by_default).<button> elements, not divs or links.Required relationships
Apply ARIA only where needed and correctly.
Header buttons
aria-expanded="true | false" reflects current statearia-controls="panel-id"Panels
role="region"aria-labelledby="header-id"hidden, inert, or equivalent to hide collapsed panels accessiblyDo not duplicate native semantics (e.g. no role="button" on <button>).
The accordion must be fully keyboard-operable:
Required
Tab / Shift+Tab: enter and exit accordion normallyEnter or Space: toggle the focused headerRecommended (ARIA pattern)
ArrowDown: move focus to next headerArrowUp: move focus to previous headerHome: move focus to first headerEnd: move focus to last headerFocus must remain on the header button when toggling.
aria-expandedprefers-reduced-motiondrupal/paragraphs module