Make the accessible accordion keyboard-navigable per the ARIA Authoring Practices Guide: Arrow Up/Down move focus between the section headers, and Home/End jump to the first/last. Crucially — and unlike tabs — every header stays a normal Tab stop; the arrows are an addition on top of Tab, not a replacement.
// A self-contained component. No props.
function App(): JSX.Element;
The accessible accordion from before, now with Arrow/Home/End focus movement between headers.
focus a header, ArrowDown → focus next header (wraps last → first)
ArrowUp → focus previous header (wraps first → last)
Home / End → first / last header
Tab → still moves through headers normally (no roving)
Enter / Space → toggle the focused section (native button behaviour)
Arrows MOVE FOCUS between headers; they do not open/close.
Opening is still click / Enter / Space on the focused header.
Tab-reachable). This is the key difference from tabs..focus() on the target; preventDefault the handled keys so the page doesn't scroll.Unlock the solution & editor
Runnable editor + tests
Solve in the browser with instant Jest feedback.
Detailed solutions
Walkthroughs, edge cases, and complexity notes.
Multi-framework variants
React, Vue, Vanilla, Angular — same question, different stacks.