starter · lesson 3 of 7

Accessibility

Keyboard, screen reader, color, motion, focus.

Sidhanshu Monga·1 min·
You’ll be able to
  1. Make any component fully keyboard operable
  2. Know when to use ARIA and when not to
  3. Meet contrast and reduced-motion requirements

Accessibility is part of the interaction design, not a checklist at the end. If a component only works with a mouse, it is unfinished.

Keyboard first

Every interactive element must be reachable with Tab, operable with Enter or Space, and dismissable with Escape where that makes sense. Focus order should follow visual order.

  • Use real buttons and links before reaching for divs with handlers
  • Never remove focus outlines without replacing them
  • Return focus to the trigger when a dialog closes

Screen readers

Semantic HTML gives you most of the accessibility tree for free. ARIA fills the gaps for patterns HTML does not cover, such as tabs, comboboxes and live regions. The first rule of ARIA is to not use it when a native element exists.

<button aria-expanded="false" aria-controls="menu-1">Options</button>

Color and motion

Body text needs a contrast ratio of at least 4.5:1, and large text at least 3:1 (WCAG 2.1, 1.4.3). Never use color alone to signal state. Respect prefers-reduced-motion by removing large movement while keeping opacity fades.

Check a few pairs yourself, including the muted label colour on this site:

practice
Check a contrast ratio
Pick a text and background color, or try a preset. Body text needs 4.5:1; large text (24px, or 19px bold) needs 3:1.
The quick brown fox jumps over the lazy dog.
Large text
4.79:1✓ AA body✓ AA large✕ AAA body
#wcag#color
Try it

Unplug your mouse and complete the main task in your product using only the keyboard. Write down every place you got stuck or lost focus.

Key takeaways
01Native elements first, ARIA second
02Focus must always be visible and return sensibly
03Never signal state with color alone