`)
- Form inputs
- Custom interactive elements (add tabindex="0")
**Focus indicators must be visible:**
```css
button:focus-visible {
outline: 2px solid #0ea5e9;
outline-offset: 2px;
}
```
**Don't remove default focus without replacement:**
```css
/* BAD */
*:focus { outline: none; }
/* GOOD */
*:focus { outline: 2px solid #0ea5e9; }
```
### Tab Order
**Natural DOM order is best:**
- Don't use `tabindex` values > 0 (breaks natural flow)
- Use `tabindex="-1"` to remove from tab order when appropriate
- Use `tabindex="0"` to add custom elements to tab order
**Skip links for long navigation:**
```html
Skip to main content
```
```css
.skip-link {
position: absolute;
top: -40px;
left: 0;
background: #000;
color: #fff;
padding: 8px;
}
.skip-link:focus {
top: 0;
}
```
### Keyboard Shortcuts
**Essential interactions:**
- **Tab**: Move forward through interactive elements
- **Shift+Tab**: Move backward
- **Enter**: Activate links/buttons
- **Space**: Activate buttons, checkboxes
- **Escape**: Close modals/dropdowns
- **Arrow keys**: Navigate within components (tabs, menus, sliders)
**Custom interactions:**
Document any custom keyboard shortcuts clearly in UI.
## Screen Readers
### Alternative Text
**Images:**
```html
```
**Icons:**
```html
...
Save
...
★
```
### ARIA Labels
**Form inputs:**
```html
Email Address
```
**Buttons:**
```html
Submit Application
...
```
**Navigation landmarks:**
```html
...
...
```
### Live Regions
**Dynamic content updates:**
```html
Error: Failed to save changes
```
**Loading states:**
```html
Loading...
```
## Forms
### Labels & Instructions
**Every input needs a label:**
```html
Username
Username
```
**Required fields:**
```html
Email Address
*
```
**Helper text:**
```html
Password
Must be at least 8 characters
```
### Error Handling
**Validation errors:**
```html
Email Address
Please enter a valid email address
```
**Error summary:**
```html
There are 2 errors in this form
```
### Fieldsets & Groups
**Related inputs:**
```html
Shipping Address
Street
City
```
**Radio button groups:**
```html
Select your plan
Basic
Pro
```
## Interactive Components
### Buttons
**Button requirements:**
- Minimum size: 44x44px (iOS guideline)
- Clear focus indicator
- Disabled state clearly visible
- Loading state announced to screen readers
```html
Save Changes
Save Changes
Saving...
```
### Modals/Dialogs
**Modal requirements:**
- Focus trap (keep focus inside modal)
- Close with Escape key
- Return focus to trigger element on close
- Screen readers announce modal opening
```html
Confirm Action
Are you sure you want to delete this item?
Cancel
Delete
```
### Dropdowns/Menus
**Menu button pattern:**
```html
Options
```
### Tabs
**Tab pattern:**
```html
Overview
Activity
Overview content...
Activity content...
```
## Mobile & Touch
### Touch Targets
**Minimum sizes:**
- 44x44px on iOS (Apple guideline)
- 48x48px on Android (Material Design)
- Use larger targets for primary actions
**Spacing:**
- 8px minimum between touch targets
- More spacing for dense interfaces
### Viewport & Zoom
**Allow zoom:**
```html
```
**Responsive text:**
- Use relative units (rem, em)
- Don't set maximum font size
- Ensure text reflows at 200% zoom
## Testing Checklist
### Automated Testing
- [ ] Run Lighthouse accessibility audit
- [ ] Check WAVE browser extension
- [ ] Validate HTML (W3C validator)
- [ ] Test color contrast (WebAIM checker)
### Manual Testing
- [ ] Navigate entire site using only keyboard
- [ ] Test with screen reader (NVDA, JAWS, VoiceOver)
- [ ] Zoom to 200% and verify layout
- [ ] Test with browser extensions disabled
- [ ] Test on mobile device
- [ ] Test with reduced motion settings
- [ ] Test in high contrast mode
### Specific Checks
- [ ] All images have alt text
- [ ] Forms have proper labels
- [ ] Focus indicators are visible
- [ ] Color is not only method of conveying info
- [ ] Text has sufficient contrast
- [ ] Headings are properly nested
- [ ] Links have descriptive text
- [ ] Videos have captions
- [ ] Audio has transcripts
- [ ] Tables have proper headers
- [ ] Interactive elements are keyboard accessible
- [ ] Error messages are clear and helpful
- [ ] Loading states are announced
- [ ] Modals trap focus and close with Escape
## Common Mistakes
**Don't:**
- Use `` or `` as buttons (use ``)
- Remove focus indicators without replacements
- Use color alone to convey meaning
- Disable zoom on mobile
- Skip heading levels
- Use placeholder as label
- Make click targets too small
- Forget alt text on images
- Use ambiguous link text ("click here")
- Prevent keyboard access to functionality
**Do:**
- Use semantic HTML elements
- Provide clear focus indicators
- Label all form inputs
- Make touch targets 44x44px minimum
- Test with keyboard and screen reader
- Provide alternatives for non-text content
- Write descriptive link text
- Announce dynamic content changes
- Support keyboard navigation patterns
- Document accessibility features
## Resources
**Testing tools:**
- Chrome DevTools Lighthouse
- WAVE (Web Accessibility Evaluation Tool)
- axe DevTools
- Screen readers: NVDA (Windows), JAWS (Windows), VoiceOver (Mac/iOS)
**Guidelines:**
- WCAG 2.1: https://www.w3.org/WAI/WCAG21/quickref/
- MDN Accessibility: https://developer.mozilla.org/en-US/docs/Web/Accessibility
- WebAIM: https://webaim.org/
**Patterns:**
- ARIA Authoring Practices: https://www.w3.org/WAI/ARIA/apg/
- Inclusive Components: https://inclusive-components.design/