Keyboard Navigation
All interactive elements must be fully operable via keyboard. Many users navigate without a mouse due to preference, disability, or device constraints.Focusability
All interactive elements must be focusable:Always use semantic HTML elements (
button, a, input) when possible. They have built-in keyboard support and proper accessibility semantics.Tab Order
Logical tab order should follow the visual flow of the interface. Users should be able to navigate through interactive elements in a predictable way.- Tab order follows DOM order
- Avoid positive
tabIndexvalues (they override natural order) - Use
tabIndex={-1}to remove elements from tab order when appropriate
Focus Indicators
Visible focus indicators are required. Never remove outlines without adding custom focus styles:focus-visible for smart focus indicators that appear for keyboard navigation but not mouse clicks.
Keyboard Shortcuts
Standard keyboard interactions that must be supported:EnterandSpace— Activate buttons and controlsEscape— Close modals, dropdowns, and dialogs- Arrow keys — Navigate within menus, lists, and tabs
Home/End— Jump to first/last item in lists
Screen Reader Support
Screen readers are used by blind and visually impaired users to navigate interfaces. Proper labeling and semantic markup are essential.Meaningful Labels
All inputs and interactive elements need accessible names:Hiding Decorative Content
Decorative elements should be hidden from screen readers:Dynamic Content
Announce dynamic content changes witharia-live:
Color Contrast
Sufficient color contrast is required for users with low vision or color blindness.WCAG Requirements
- Normal text — At least 4.5:1 contrast ratio
- Large text (18px+ or 14px+ bold) — At least 3:1 contrast ratio
- Interactive elements — At least 3:1 contrast for boundaries and states
Color as Information
Don’t rely solely on color to convey information:Interactive States
All interactive elements need visible states:- Default — Base state
- Hover — Mouse hover indication
- Focus — Keyboard focus indication
- Active — Currently pressed/active
- Disabled — Non-interactive state
Motion and Animation
Respect user preferences for reduced motion. Some users experience vestibular disorders that make animations nauseating or distracting.Reduced Motion Preference
Always check and respectprefers-reduced-motion:
Animation Guidelines
- Keep animations subtle and purposeful
- Avoid content that flashes more than 3 times per second
- Provide alternatives to motion-based feedback
Semantic HTML
Use semantic HTML elements to provide structure and meaning:Landmarks
Interactive Elements
- Use
<button>for actions - Use
<a>for navigation - Use
<input>for user input - Use
<select>for dropdowns
Headings
Maintain a logical heading hierarchy:Never skip heading levels (e.g., h1 to h3). Screen reader users often navigate by headings, and a logical hierarchy helps them understand page structure.
ARIA Attributes
ARIA (Accessible Rich Internet Applications) attributes enhance accessibility when semantic HTML isn’t enough.Common ARIA Roles
role="button"— For custom buttonsrole="dialog"— For modals and dialogsrole="alert"— For important announcementsrole="menu"— For menu widgetsrole="tab"— For tab interfaces
ARIA States
aria-expanded— For collapsible elementsaria-selected— For selectable itemsaria-checked— For custom checkboxesaria-disabled— For disabled elementsaria-hidden— To hide decorative elements
ARIA Properties
aria-label— Accessible namearia-labelledby— Reference to label elementaria-describedby— Reference to descriptionaria-live— Announce dynamic changes
Testing Checklist
Before considering a component accessible, verify:- Can be operated entirely with keyboard
- Has visible focus indicators
- Works with screen readers (test with NVDA, JAWS, or VoiceOver)
- Meets WCAG 2.1 AA contrast requirements
- Respects
prefers-reduced-motion - Uses semantic HTML where possible
- Has appropriate ARIA attributes
- Announces dynamic changes appropriately
- All interactive elements have accessible names