Make the accessible tabs keyboard-navigable the way the ARIA Authoring Practices Guide specifies: the whole tablist is a single Tab stop, and once focus is on it, the arrow keys move between tabs (Home/End jump to the ends). This is the roving tabindex pattern — exactly one tab is tabbable at a time, and focus follows the selection.
// A self-contained component. No props.
function App(): JSX.Element;
The ARIA tabs from before, now with roving tabindex and Arrow/Home/End key handling.
Tab into the tablist → lands on the SELECTED tab (one stop, not three)
ArrowRight → next tab (wraps from last to first), focus + panel follow
ArrowLeft → previous tab (wraps from first to last)
Home / End → first / last tab
Tab again → leaves the tablist (into the panel), not the next tab
Roving tabindex: selected tab → tabIndex 0; all others → tabIndex -1
tabIndex={0}; the rest are -1. So Tab enters the tablist once (onto the selected tab) and the next Tab leaves it — arrows handle movement within.keydown, ArrowRight/Left change the selected index (wrapping), Home/End go to the ends; preventDefault so the page doesn't scroll.-1 element.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.