The Accessibility Tree and WAI-ARIA Semantics
Browsers compile a parallel Accessibility Tree from the DOM and CSSOM, stripping decorative nodes and computing four fields per control: Role, Name, State, and Value. ARIA attributes only patch this metadata layer, they never add keyboard behavior or focusability on their own.
Accessible Controls: Div Soup + ARIA vs Native HTML
<div role="button" tabIndex={0}
aria-pressed={active}
onClick={toggle}
onKeyDown={(e) => (e.key === 'Enter' || e.key === ' ') && toggle()}>
Mute
</div>Misses Space keyup scroll prevention, disabled semantics, and form integration.
<button type="button"
aria-pressed={active}
onClick={toggle}>
Mute
</button>Native role, focusability, Enter/Space activation, and disabled state.
Under the Hood
If the Browser Rendering Pipeline paints pixels for eyes, the Accessibility Tree serializes a structured wireframe for OS assistive APIs (UIA on Windows, NSAccessibility on macOS, ATK on Linux).
- CSS Pruning:
display: none,visibility: hidden, andaria-hidden="true"remove nodes from the Accessibility Tree, whereasopacity: 0leaves them exposed. - AccName Computation: Engines resolve an element's Accessible Name in strict precedence:
aria-labelledby>aria-label> native<label>/alt> text content. - Metadata Only: Setting
role="button"changes the tree node's role string, but does not wireTabfocus orEnter/Spacekey activation, unlike<button>or Native Dialog.
<!-- Bad: role="presentation" or aria-hidden="true" on a focusable control -->
<button aria-hidden="true">Broken</button>
<!-- Good: native semantics + dynamic ARIA state + live region -->
<button type="button" aria-expanded="false" aria-controls="menu-list">
Options
</button>
<div role="status" aria-live="polite">Saved 3 items.</div>Problem Genealogy
- 1999–2008 (DHTML Widget Era): Custom
<div>dropdowns and tabs left screen readers blind because HTML4 had no widget roles. - 2014 (WAI-ARIA 1.0): Standardized
role,aria-*states, and live regions across browsers and screen readers. - 2022+ (
inert& Popover/Dialog): Shifted modal and disclosure semantics back into native HTML attributes to eliminate manual ARIA traps.
Production Pitfalls
- First Rule of ARIA violation: Replacing
<button>with<div role="button">drops keyboard activation, form submission, and disabled semantics for zero gain. aria-hidden="true"on focusable elements: Leaves the button reachable viaTabwhile hiding its announcement from screen readers ("ghost focus"); use theinertattribute instead.
- When not to use ARIA: Whenever a native HTML element (
<button>,<a href>,<input>,<dialog>) already carries the required role and keyboard behavior, omit redundantroleattributes; for Custom Elements, expose roles viaElementInternalsinstead of mutating hostaria-*attributes.
Connections & Logical Next Steps
Role and accessible-name queries resolve against WAI-ARIA role mappings and AccName computation.
Headless primitives wire aria-expanded, aria-controls, and unique IDs automatically across compound parts.
Roving tabindex pairs with composite ARIA roles (tablist, menu, toolbar) so screen readers announce item positions.
CSS visibility (display: none, visibility: hidden) prunes nodes from the Accessibility Tree.
Native <dialog>.showModal() marks background siblings inert in both focus order and the Accessibility Tree.
Native elements expose built-in ARIA semantics, whereas autonomous custom elements require ElementInternals to wire roles.