Take the basic accordion and give it the ARIA accordion structure that screen readers expect: each header is a real heading containing a button, the button announces its expanded/collapsed state, and each open panel is a region named by its header. Same look and toggle behaviour — but now navigable and understandable with assistive technology.
// A self-contained component. No props.
function App(): JSX.Element;
The same multi-open accordion, now with heading-wrapped buttons, aria-expanded, and labelled panel regions.
<h3 class="accordion-heading">
<button id="header-css" aria-expanded="true" aria-controls="panel-css">CSS</button>
</h3>
<div id="panel-css" role="region" aria-labelledby="header-css">…</div>
- header button: aria-expanded reflects open/closed; aria-controls → panel id
- panel: role="region" + aria-labelledby → header id (so the region is named)
<h3> (with the button inside) lets screen-reader users jump between sections via heading navigation.aria-expanded={isOpen} on the button so AT says "expanded" / "collapsed".role="region" with aria-labelledby pointing at its header button's id — the region takes the header's name. Pair it with aria-controls (button → panel id).