Skip to main content

Lesson 7: Accessibility Deep Dive

Validate primitive behavior with practical keyboard and screen-reader audits, and learn common failure modes.

What primitives handle automatically

For dialog-like patterns, primitives provide:

  • dialog role and structural semantics,
  • label/description linkage,
  • trigger state attributes,
  • focus trap and restoration,
  • escape/outside dismissal patterns.

This baseline is strong, but wrappers can still break it.


Most common breakages

  1. Missing or meaningless dialog title.
  2. Icon-only actions without aria-label.
  3. Incorrect use of tooltip for interactive content.
  4. Moving interactive nodes outside intended focus/layer boundaries.
  5. Preventing default on dismissal events without alternative close path.

Manual keyboard audit script

For each overlay component:

  1. Focus trigger with Tab.
  2. Activate with Enter or Space.
  3. Traverse all controls with Tab and Shift+Tab.
  4. Close with Escape.
  5. Confirm focus returns to expected anchor.

If any step fails, block release.


Screen reader audit script

Verify with VoiceOver or NVDA:

  • Trigger announces intent.
  • Dialog/menu role is announced.
  • Title/description are meaningful.
  • Item states (checked/selected/disabled) are communicated.

Do not rely on visual inspection as proof.


Inspecting semantics in DevTools

Use browser accessibility tooling to verify:

  • computed role,
  • accessible name,
  • accessible description,
  • state attributes.

This catches wrapper-level mistakes quickly.


Accessibility release checklist

  • All modal surfaces have titles.
  • All icon buttons have labels.
  • Escape closes where expected.
  • Focus never gets lost after close.
  • Reduced-motion path is usable.
  • Color and contrast checks pass for all states.

Lab

  1. Audit your dialog, popover, and menu wrappers with keyboard only.
  2. Run a screen-reader pass and document announcements.
  3. Fix at least one issue found and note root cause.