Accessibility
Intermediate Chapter 6 covered ARIA's first rule and the most common attributes. This chapter goes into genuinely complex interactive widgets — tabs, accordions — where building correct keyboard and screen reader behaviour requires deliberate, specific patterns rather than relying on a native element doing the work automatically.
The ARIA Authoring Practices Guide — The Reference Worth Knowing About
The W3C maintains a living reference (the ARIA Authoring Practices Guide, "APG") with exact, tested patterns for every common complex widget — tabs, accordions, comboboxes, menus, dialogs. Rather than inventing keyboard behaviour from scratch, checking the APG's published pattern for a given widget type first avoids reinventing something that's already been carefully specified and tested.
The Tabs Pattern
Roving tabindex — The Key Technique Behind Tabs
Notice only the selected tab has tabindex="0" (the default for a button) while the unselected one has tabindex="-1" — this is the "roving tabindex" pattern: exactly one item in the group is reachable by Tab at any time, while Left/Right arrow keys (handled by your own JavaScript) move selection and update which tab has tabindex="0".
<select> already behaves.
The Accordion Pattern
<details>/<summary> offers is genuinely required. For a straightforward expand/collapse FAQ, the native element from Intermediate Chapter 8 gets all of this correct automatically, with far less code — worth checking whether the simpler native option is sufficient before building a custom ARIA pattern.
Common ARIA Widget Patterns at a Glance
| Pattern | Key roles/attributes | Key keyboard behaviour |
|---|---|---|
| Tabs | tablist/tab/tabpanel, aria-selected | Arrow keys move between tabs, roving tabindex |
| Accordion | aria-expanded, aria-controls | Enter/Space toggles; often just native button behaviour |
| Menu | menu/menuitem, aria-expanded on the trigger | Arrow keys navigate items, Escape closes |
| Combobox | combobox/listbox/option, aria-expanded, aria-activedescendant | Arrow keys move through suggestions, Enter selects |
Testing with a Real Screen Reader
A Minimal Testing Routine
- Turn on a screen reader and close your eyes (or turn off the monitor). Genuinely try to complete the page's main task using only what you hear.
- Navigate by headings first (most screen readers have a dedicated heading-jump shortcut) — confirms the heading structure from Fundamentals Chapter 2 actually makes sense out loud.
- Tab through every interactive element — confirm each one announces a clear name and role, and that focus order matches the visual reading order.
- Try the actual complex widgets (any tabs, accordions, custom dropdowns) specifically — this is where most real accessibility bugs concentrate.
Chapter 8 Quick Reference
- ARIA Authoring Practices Guide (APG) — the W3C's tested reference patterns; check it before inventing custom widget behaviour
- Roving tabindex — exactly one item reachable by Tab at a time; arrow keys move within the group (tabs, menus)
- Prefer details/summary over a custom accordion when the native element's behaviour is genuinely sufficient
- Common patterns: tabs, accordion, menu, combobox — each with specific roles and keyboard expectations
- Real screen readers: NVDA (Windows, free), VoiceOver (Mac/iOS, built in), JAWS (Windows, commercial)
- Minimal testing routine: heading navigation, full Tab traversal, specifically exercise any custom widgets
- Visual correctness ≠ accessible correctness — manual screen reader testing catches what automated tools and a sighted check both miss
- Next chapter: performance — lazy loading, preload/prefetch, critical rendering path