Accessibility (a11y) Skill
Use this skill when building accessible UI that works for all users.
Overview
Build interfaces that are usable by everyone, including people with disabilities. Follow WCAG 2.1 guidelines.
When to Use
Use this skill when:
- Creating new UI components
- Making UI accessible
- Adding ARIA labels
- Ensuring WCAG compliance
Workflow
Step 1: Semantic HTML
- Use correct HTML elements
- Use heading hierarchy (h1 → h2 → h3)
- Use proper form labels
- Use landmarks (nav, main, aside)
Checklist:
- Buttons use
<button>, not<div> - Links use
<a>, not clickable divs - Forms have
<label>elements - Headings are in order (no skipping)
- Lists use
<ul>or<ol>
Step 2: Keyboard Navigation
- Ensure all interactive elements are keyboard accessible
- Provide visible focus indicators
- Implement logical tab order
- Handle keyboard shortcuts
Checklist:
- All interactive elements reachable via Tab
- Focus indicators are visible
- Tab order is logical
- Escape closes modals/dropdowns
- Enter/Space activate buttons
- Arrow keys work in menus/lists
Step 3: ARIA Attributes
- Add ARIA labels where needed
- Use ARIA roles appropriately
- Manage ARIA states
- Provide ARIA descriptions
Common ARIA:
aria-label: Descriptive labelaria-labelledby: Reference to label elementaria-describedby: Additional descriptionaria-hidden: Hide decorative elementsaria-live: Announce dynamic changesrole: Define element role
Example:
<button aria-label="Close dialog">
<span aria-hidden="true">×</span>
</button>
Step 4: Color and Contrast
- Ensure sufficient color contrast (WCAG AA: 4.5:1)
- Don't rely on color alone
- Provide alternative indicators
- Test with color blindness simulators
Checklist:
- Text contrast meets WCAG AA (4.5:1)
- Large text contrast meets WCAG AA (3:1)
- Interactive elements have 3:1 contrast
- Information not conveyed by color alone
- Focus indicators are visible
Step 5: Images and Media
- Provide alt text for images
- Provide captions for videos
- Provide transcripts for audio
- Mark decorative images appropriately
Alt Text Guidelines:
- Descriptive and concise
- Conveys same information as image
- Empty alt="" for decorative images
- Include text in images in alt text
Step 6: Forms
- Associate labels with inputs
- Provide error messages
- Indicate required fields
- Provide helpful instructions
Checklist:
- All inputs have labels
- Labels are associated (for/id)
- Required fields indicated
- Error messages are clear
- Errors are announced to screen readers
Step 7: Testing
- Test with keyboard only
- Test with screen reader
- Use automated tools (axe, Lighthouse)
- Test with real users when possible
Tools:
- axe DevTools
- Lighthouse
- WAVE
- Screen readers (NVDA, JAWS, VoiceOver)
WCAG Principles
- Perceivable: Information must be presentable to users
- Operable: Interface components must be operable
- Understandable: Information and UI operation must be understandable
- Robust: Content must be robust enough for assistive technologies
Common Issues
- Missing alt text
- Poor color contrast
- Missing focus indicators
- Non-semantic HTML
- Missing ARIA labels
- Keyboard traps
- Missing form labels
Verification
- Keyboard navigation works
- Screen reader tested
- Color contrast passes
- All images have alt text
- Forms are accessible
- Automated tools pass
Related Skills
- Frontend Aesthetics - Visual quality + accessibility
- Component Design - Accessible component design
Related Commands
- Fix Command - Fix accessibility issues
Next Steps
- Frontend Aesthetics - Ensure visual quality
- Test Driven Development - Write accessibility tests