The ARIA tabs pattern with roving tabindex. Covers horizontal and vertical tabs, manual vs automatic activation, and fixes for the common “divs with onClick” anti-pattern — in Vanilla and React.
WCAG: 2.1.1 · 2.4.3 · 4.1.2
Level: Intermediate
Icons: none (text tabs)
1
What we are building
A tablist that follows the ARIA Authoring Practices Guide — the pattern browsers themselves use.
What we are building
Tabs need the roving tabindex pattern: only the active tab is in the Tab sequence; arrow keys move within the tablist; Enter / Space activates. Tab leaves the tablist and lands on the panel. This mirrors how Chrome, Firefox and Safari handle their own browser tabs.
2
The 4 real-world variants
Switch between the inaccessible version and the accessible fix.
The 4 real-world variants
Variant A
Standard horizontal tabs
Preferred
Live example
Profile
Panel content for “profile”. Tab from the active tab lands here.
Billing
Panel content for “billing”. Tab from the active tab lands here.
Notifications
Panel content for “notifications”. Tab from the active tab lands here.