Accessible Tabs
This lesson explains Accessible Tabs in web accessibility with clear examples, practical use cases, and implementation best practices.
Accessible Tabs Overview
Tabs organize related content into separate panels, allowing users to
switch between sections without navigating to a new page. Accessible tabs
provide a familiar interface while supporting keyboard users, screen
reader users, and people using assistive technologies.
A well-designed tab interface uses semantic HTML, proper ARIA roles,
keyboard navigation, visible focus indicators, and synchronized tab and
panel states. These practices improve usability and help meet Web Content
Accessibility Guidelines (WCAG).
| Feature | Benefit |
| Keyboard Navigation | Switch between tabs without a mouse. |
| ARIA Roles | Help screen readers identify tabs and panels. |
| Visible Focus | Shows which tab currently has keyboard focus. |
| Selected State | Indicates the active tab. |
| Logical Structure | Keeps related content organized. |
| WCAG Compliance | Supports accessible interactive components. |
Accessible Tabs Example
<div role="tablist">
<button
role="tab"
aria-selected="true"
aria-controls="panel-1">
Overview
</button>
<button
role="tab"
aria-selected="false"
aria-controls="panel-2">
Features
</button>
</div>
<section
id="panel-1"
role="tabpanel">
Tab Content
</section>
The tablist, tab, and
tabpanel roles create clear relationships between tabs and
their associated content. The
aria-selected attribute indicates which tab is currently
active.
Common Tab Components
Accessible tab interfaces consist of several related elements that work
together to provide a predictable user experience.
| Component | Purpose | Example |
| Tab List | Groups all tabs together. | Product Navigation |
| Tab | Selects a content panel. | Description |
| Tab Panel | Displays the selected content. | Product Details |
| Selected State | Shows the active tab. | Current Section |
| Keyboard Controls | Move between tabs using arrow keys. | Left and Right Arrows |
| Focus Management | Keeps navigation predictable. | Focus Active Tab |
Accessible Tabs Best Practices
| Best Practice | Description |
| Use Proper ARIA Roles | Implement tablist, tab, and tabpanel roles correctly. |
| Support Keyboard Navigation | Allow navigation using Tab and Arrow keys. |
| Maintain Visible Focus | Show which tab currently has keyboard focus. |
| Synchronize States | Update aria-selected when users switch tabs. |
| Associate Tabs and Panels | Link tabs with their corresponding content panels. |
| Use Clear Labels | Give each tab a meaningful and descriptive name. |
Common Tab Accessibility Mistakes
- Using clickable div elements instead of buttons for tabs.
- Not supporting Arrow key navigation.
- Failing to update aria-selected when tabs change.
- Not associating tabs with their corresponding panels.
- Removing keyboard focus indicators.
- Displaying multiple active tabs simultaneously.
- Using vague tab names such as "Tab 1" and "Tab 2".
- Not testing tabs with keyboard navigation and screen readers.
Key Takeaways
- Use proper ARIA roles for accessible tab interfaces.
- Support keyboard navigation with Tab and Arrow keys.
- Maintain visible focus and update selected states.
- Associate each tab with its corresponding content panel.
- Use descriptive tab labels that clearly identify content.
- Accessible tabs improve usability, accessibility, and WCAG compliance.
Pro Tip
Build tabs using native button elements instead of clickable
div elements. Buttons automatically provide keyboard support,
focus management, and better compatibility with assistive technologies,
reducing the amount of custom accessibility code you need to maintain.