Web Accessibility Guide

Web accessibility (a11y) means people with disabilities can use the web. Not just blind users with screen readers — also keyboard-only users, motor-impaired users, color-blind users, users with cognitive disabilities, deaf users.

It's also legally required in many jurisdictions and a moral baseline for public-facing software.

This page covers the foundations.

WCAG

Web Content Accessibility Guidelines. The standard. WCAG 2.1 AA is the common compliance target.

Four principles (POUR):

WCAG has specific success criteria. Most are common-sense rules that good design follows naturally.

Semantic HTML

The single biggest accessibility win: use the right HTML elements.

<!-- Bad: a div pretending to be a button -->
<div onClick={handleClick}>Click me</div>

<!-- Good: an actual button -->
<button onClick={handleClick}>Click me</button>

The button:

Reimplementing buttons with divs requires recreating all of this with ARIA. Just use the button.

Semantic elements that matter:

ARIA when semantic HTML isn't enough

ARIA (Accessible Rich Internet Applications) provides attributes for accessibility info that HTML doesn't natively express:

<button aria-label="Close dialog" aria-expanded="false">
    <svg>...</svg>  <!-- icon -->
</button>

The first rule of ARIA: don't use ARIA. Use semantic HTML when possible.

The second rule: when ARIA is needed, learn the patterns. The W3C's ARIA Authoring Practices Guide is the canonical source.

Common use cases:

Keyboard navigation

Not everyone uses a mouse. Power users and users with motor disabilities use keyboards.

Required:

Common failures:

Test: navigate your entire app with only the keyboard. Notice every place it doesn't work.

Screen reader testing

Screen readers convert visual content to speech (or braille). Test with one:

Open your app; navigate by Tab and arrow keys; listen.

Common failures:

You don't need to be expert; basic listening reveals most problems.

Color contrast

WCAG AA: 4.5:1 for body text, 3:1 for large text.

Tools test contrast (browser DevTools, WebAIM Contrast Checker). Test your design system colors at design time, not after.

Don't communicate solely with color:

Forms

Forms are common accessibility failure points.

Required:

See FormHandlingAndValidation.

Common patterns

A link at the top of the page that skips to main content. Hidden until focused.

<a href="#main" class="skip-link">Skip to main content</a>

For keyboard users navigating around extensive headers/navigation.

Focus management

After a modal opens, focus moves into the modal. After it closes, focus returns to the trigger. Without this, keyboard users get lost.

Modern modal libraries handle this; custom implementations need explicit work.

Live regions

For dynamic content that should be announced:

<div role="status" aria-live="polite">
    Item added to cart
</div>

Screen readers announce changes to live regions.

Tools

Axe

Browser extension and library. Runs accessibility tests on a page; reports violations. The standard automated tool.

Most accessibility issues axe catches; more nuanced ones require manual testing.

Lighthouse

Built into Chrome DevTools. Has an accessibility audit (uses axe under the hood).

Wave

Browser extension. Visual accessibility audit.

Manual testing

Automated tools catch ~30% of issues. Manual testing (keyboard, screen reader) catches the rest.

Common failure patterns

Further Reading