Hub: index · watch · videos · note

Tabs demo (ARIA tablist + roving tabindex)

A tab UI can look right and still be painful with a keyboard or screen reader. This micro-demo compares a click-only “tabs” row (BEFORE) with a proper role="tablist" implementation (AFTER) that supports arrow keys, Home/End, and state announcement.

AFTER Keyboard: Tab to enter · ←/→ move · Home/End jump · Enter/Space activate
Compare

Interactive demo

Try keyboard navigation in both modes. In AFTER mode, only the active tab is in the Tab order (roving tabindex), and arrow keys move focus within the tab row.

Activation: Orientation:

Profile

Editable fields belong inside the active panel. Press Tab to move into the panel content.

Selected tab: Profile.

Takeaways

  • Use explicit roles: tablist → tab → tabpanel.
  • Link tabs and panels with aria-controls + aria-labelledby.
  • Use roving tabindex so only one tab is in the tab order.
  • Support ←/→ (or ↑/↓ for vertical), plus Home/End.
  • Hide inactive panels with hidden to avoid “ghost focus”.

Companion note: Tabs checklist.