Back to Homeaccessibility cheat sheet
Key accessibility guidelines, ARIA patterns, and WCAG standards for building inclusive web experiences.
wcag fundamentals
Web Content Accessibility Guidelines (WCAG) is the standard for building inclusive web experiences.
- 1
Perceivable: Information must be presented in ways users can perceive
- 2
Operable: Interface components must be operable by all users
- 3
Understandable: Information and UI must be understandable
- 4
Robust: Content must work with current and future technologies
- 5
Level A: Basic accessibility (minimum)
- 6
Level AA: Industry standard (aim for this)
- 7
Level AAA: Enhanced accessibility (nice to have)
- 8
Color contrast ratio of at least 4.5:1 for text
- 9
All functionality available via keyboard
aria attributes
ARIA fills the gaps for dynamic content and custom widgets.
- 1
Navigation:<nav role="navigation" aria-label="Main">
- 2
Modal dialog:<div role="dialog" aria-modal="true">
- 3
Alert:<div role="alert" aria-live="assertive">
- 4
Expanded state:<button aria-expanded={isOpen}>
- 5
Current page:<a aria-current="page">
- 6
Hidden content:<div aria-hidden="true">
- 7
Descriptions:<input aria-describedby="password-hint">
- 8
First rule of ARIA: Don't use ARIA. Use semantic HTML first.
keyboard navigation
Many users rely solely on keyboards or assistive devices.
- 1
Tab: Navigate forward through focusable elements
- 2
Shift + Tab: Navigate backward
- 3
Enter/Space: Activate buttons and links
- 4
Escape: Close modals and dialogs
- 5
Arrow keys: Navigate within components (menus, tabs)
- 6
Make focusable:<div tabIndex={0}>
- 7
Remove from tab order:<div tabIndex={-1}>
- 8
Skip to content:<a href="#main" class="sr-only focus:not-sr-only">
- 9
Focus visible:<button class="focus-visible:ring-2">
visual accessibility
Design for all vision abilities with proper contrast and clear focus indicators.
- 1
Normal text: 4.5:1 contrast ratio minimum
- 2
Large text (18.66px+): 3:1 contrast ratio minimum
- 3
UI components: 3:1 contrast ratio for borders, icons
- 4
Don't rely on color alone to convey information
- 5
Allow text resizing up to 200%
- 6
Sufficient line height:line-height: 1.5
- 7
Proper heading hierarchy: h1, h2, h3...
- 8
Visible focus ring:outline: 2px solid blue; outline-offset: 2px;
common mistakes
Avoid these accessibility pitfalls that break the experience for users.
- 1
Using divs as buttons
Use <button> instead of <div onClick>
- 2
Missing alt text on images
Always include alt="" for decorative images
- 3
Low contrast text
Test with WebAIM or Lighthouse
- 4
Placeholder as label
Use proper <label> elements
- 5
Auto-playing media
Provide play/pause controls
- 6
Testing tools: axe DevTools, WAVE, Lighthouse, NVDA, VoiceOver