Accessibility & WCAG Compliance
Provides WCAG 2.1 Level AA compliance patterns for accessible web development including semantic HTML, ARIA implementation, keyboard navigation, and screen reader compatibility.
Description
This skill teaches accessibility agents how to evaluate and implement WCAG 2.1 Level AA standards across web applications. It covers the four POUR principles (Perceivable, Operable, Understandable, Robust), ARIA attributes, keyboard navigation patterns, color contrast requirements, and assistive technology compatibility.
When to Use
- Reviewing UI components for accessibility compliance
- Implementing keyboard navigation
- Adding ARIA labels and roles
- Evaluating color contrast ratios
- Testing screen reader compatibility
- Conducting WCAG 2.1 audits
When NOT to Use
- Do not use for backend-only changes with no user-facing output.
- Do not use for internal CLI tools where accessibility standards do not apply.
Entry Points
Trigger Phrases: "accessibility review", "WCAG compliance", "screen reader", "keyboard navigation", "ARIA", "a11y audit"
Context Patterns: UI component implementations, form designs, interactive widgets, color scheme changes, content structure updates
Core Knowledge
POUR Principles
Perceivable
- Text alternatives: Alt text for images, transcripts for audio
- Time-based media: Captions for videos, audio descriptions
- Adaptable: Semantic HTML, proper heading hierarchy
- Distinguishable: Color contrast 4.5:1 (text), 3:1 (UI components)
Operable
- Keyboard accessible: All functionality via keyboard, no keyboard traps
- Enough time: Adjustable time limits, pause/stop animations
- Seizures: No flashing content >3 times per second
- Navigable: Skip links, focus indicators, meaningful link text
Understandable
- Readable: Language declared, simple language where possible
- Predictable: Consistent navigation, no unexpected context changes
- Input assistance: Error identification, labels/instructions, error suggestions
Robust
- Compatible: Valid HTML, proper ARIA usage, assistive tech support
ARIA Attributes
| Attribute |
Purpose |
Example |
role |
Define element purpose |
<div role="navigation"> |
aria-label |
Accessible name |
<button aria-label="Close dialog">×</button> |
aria-labelledby |
Reference label ID |
<input aria-labelledby="username-label"> |
aria-describedby |
Additional context |
<input aria-describedby="password-hint"> |
aria-hidden |
Hide from screen readers |
<span aria-hidden="true">★</span> |
aria-live |
Announce dynamic changes |
<div aria-live="polite"> |
aria-expanded |
Collapsible state |
<button aria-expanded="false"> |
Color Contrast Requirements
WCAG 2.1 Level AA:
- Normal text: 4.5:1 minimum
- Large text (18pt+ or 14pt+ bold): 3:1 minimum
- UI components and graphics: 3:1 minimum
Tools: Chrome DevTools (Inspect > Accessibility), WebAIM Contrast Checker
Keyboard Navigation Patterns
| Pattern |
Keys |
Example |
| Tab order |
Tab, Shift+Tab |
Form inputs, buttons, links |
| Menu navigation |
Arrow keys |
Dropdown menus, tree views |
| Dialog |
Esc (close), Tab (trap focus) |
Modal dialogs |
| Radio group |
Arrow keys (select), Tab (exit group) |
Radio button sets |
| Combobox |
Arrow keys (options), Enter (select) |
Autocomplete inputs |
Accessibility Review Template
## Accessibility Review: [Component]
### WCAG 2.1 Level AA Compliance
#### Perceivable
- [ ] Alt text for images (1.1.1)
- [ ] Color contrast ≥4.5:1 for text (1.4.3)
- [ ] Semantic HTML structure (1.3.1)
- [ ] Content not solely conveyed by color (1.4.1)
#### Operable
- [ ] All functionality keyboard accessible (2.1.1)
- [ ] No keyboard traps (2.1.2)
- [ ] Visible focus indicators (2.4.7)
- [ ] Skip navigation links (2.4.1)
#### Understandable
- [ ] Language declared (lang="en") (3.1.1)
- [ ] Labels for form inputs (3.3.2)
- [ ] Error identification and suggestions (3.3.1, 3.3.3)
- [ ] Consistent navigation (3.2.3)
#### Robust
- [ ] Valid HTML (4.1.1)
- [ ] ARIA attributes used correctly (4.1.2)
- [ ] Name, role, value for custom controls (4.1.2)
### Findings
#### BLOCKER: [Issue]
- **WCAG Criterion:** [Number and description]
- **Impact:** [Screen readers, keyboard users, low vision]
- **Location:** [Component:line]
- **Fix:** [Specific recommendation]
### Screen Reader Testing
- **NVDA:** [Pass/Fail with notes]
- **JAWS:** [Pass/Fail with notes]
- **VoiceOver:** [Pass/Fail with notes]
### Verdict
- [ ] APPROVED (WCAG 2.1 AA compliant)
- [ ] MINOR_ISSUES (usable, improvements recommended)
- [ ] MAJOR_ISSUES (blocks compliance, must fix)
Examples
Example: Inaccessible Form
⌠Before (Non-compliant):
<form>
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<div style="color: red;">Invalid credentials</div>
<span
</form>
Issues:
- No labels (WCAG 3.3.2)
- Error not associated with input (WCAG 3.3.1)
- Submit not keyboard accessible (WCAG 2.1.1)
- No focus indicators
✅ After (Compliant):
<form>
<div>
<label for="username">Username</label>
<input
id="username"
type="text"
aria-describedby="username-error"
aria-invalid="true"
>
<span id="username-error" role="alert">
Invalid credentials. Please check your username and password.
</span>
</div>
<div>
<label for="password">Password</label>
<input
id="password"
type="password"
aria-describedby="password-hint"
>
<span id="password-hint">
Must be at least 8 characters
</span>
</div>
<button type="submit">Submit</button>
</form>
<style>
input:focus, button:focus {
outline: 2px solid blue;
outline-offset: 2px;
}
</style>
Improvements:
- Explicit
<label> elements (WCAG 3.3.2) ✓
aria-invalid and aria-describedby for errors (WCAG 3.3.1) ✓
<button> for keyboard accessibility (WCAG 2.1.1) ✓
- Visible focus indicators (WCAG 2.4.7) ✓
References
- WCAG 2.2 Success Criteria — Key Level A/AA criteria quick reference
- ARIA Patterns — Common patterns, anti-patterns, and code examples
External references
1---2name: accessibility-wcag3description: WCAG 2.1 Level AA compliance patterns for semantic HTML, ARIA, keyboard navigation, and screen reader compatibility. Use for accessibility audits, ARIA reviews, and POUR principle validation.4---56# Accessibility & WCAG Compliance78Provides WCAG 2.1 Level AA compliance patterns for accessible web development including semantic HTML, ARIA implementation, keyboard navigation, and screen reader compatibility.910## Description1112This skill teaches accessibility agents how to evaluate and implement WCAG 2.1 Level AA standards across web applications. It covers the four POUR principles (Perceivable, Operable, Understandable, Robust), ARIA attributes, keyboard navigation patterns, color contrast requirements, and assistive technology compatibility.1314## When to Use1516- Reviewing UI components for accessibility compliance17- Implementing keyboard navigation18- Adding ARIA labels and roles19- Evaluating color contrast ratios20- Testing screen reader compatibility21- Conducting WCAG 2.1 audits2223### When NOT to Use2425- Do not use for backend-only changes with no user-facing output.26- Do not use for internal CLI tools where accessibility standards do not apply.2728## Entry Points2930**Trigger Phrases:** "accessibility review", "WCAG compliance", "screen reader", "keyboard navigation", "ARIA", "a11y audit"3132**Context Patterns:** UI component implementations, form designs, interactive widgets, color scheme changes, content structure updates3334## Core Knowledge3536### POUR Principles3738#### Perceivable39- **Text alternatives:** Alt text for images, transcripts for audio40- **Time-based media:** Captions for videos, audio descriptions41- **Adaptable:** Semantic HTML, proper heading hierarchy42- **Distinguishable:** Color contrast 4.5:1 (text), 3:1 (UI components)4344#### Operable45- **Keyboard accessible:** All functionality via keyboard, no keyboard traps46- **Enough time:** Adjustable time limits, pause/stop animations47- **Seizures:** No flashing content >3 times per second48- **Navigable:** Skip links, focus indicators, meaningful link text4950#### Understandable51- **Readable:** Language declared, simple language where possible52- **Predictable:** Consistent navigation, no unexpected context changes53- **Input assistance:** Error identification, labels/instructions, error suggestions5455#### Robust56- **Compatible:** Valid HTML, proper ARIA usage, assistive tech support5758### ARIA Attributes5960| Attribute | Purpose | Example |61|-----------|---------|---------|62| `role` | Define element purpose | `<div role="navigation">` |63| `aria-label` | Accessible name | `<button aria-label="Close dialog">×</button>` |64| `aria-labelledby` | Reference label ID | `<input aria-labelledby="username-label">` |65| `aria-describedby` | Additional context | `<input aria-describedby="password-hint">` |66| `aria-hidden` | Hide from screen readers | `<span aria-hidden="true">★</span>` |67| `aria-live` | Announce dynamic changes | `<div aria-live="polite">` |68| `aria-expanded` | Collapsible state | `<button aria-expanded="false">` |6970### Color Contrast Requirements7172**WCAG 2.1 Level AA:**73- Normal text: 4.5:1 minimum74- Large text (18pt+ or 14pt+ bold): 3:1 minimum75- UI components and graphics: 3:1 minimum7677**Tools:** Chrome DevTools (Inspect > Accessibility), WebAIM Contrast Checker7879### Keyboard Navigation Patterns8081| Pattern | Keys | Example |82|---------|------|---------|83| Tab order | Tab, Shift+Tab | Form inputs, buttons, links |84| Menu navigation | Arrow keys | Dropdown menus, tree views |85| Dialog | Esc (close), Tab (trap focus) | Modal dialogs |86| Radio group | Arrow keys (select), Tab (exit group) | Radio button sets |87| Combobox | Arrow keys (options), Enter (select) | Autocomplete inputs |8889### Accessibility Review Template9091```markdown92## Accessibility Review: [Component]9394### WCAG 2.1 Level AA Compliance9596#### Perceivable97- [ ] Alt text for images (1.1.1)98- [ ] Color contrast ≥4.5:1 for text (1.4.3)99- [ ] Semantic HTML structure (1.3.1)100- [ ] Content not solely conveyed by color (1.4.1)101102#### Operable103- [ ] All functionality keyboard accessible (2.1.1)104- [ ] No keyboard traps (2.1.2)105- [ ] Visible focus indicators (2.4.7)106- [ ] Skip navigation links (2.4.1)107108#### Understandable109- [ ] Language declared (lang="en") (3.1.1)110- [ ] Labels for form inputs (3.3.2)111- [ ] Error identification and suggestions (3.3.1, 3.3.3)112- [ ] Consistent navigation (3.2.3)113114#### Robust115- [ ] Valid HTML (4.1.1)116- [ ] ARIA attributes used correctly (4.1.2)117- [ ] Name, role, value for custom controls (4.1.2)118119### Findings120121#### BLOCKER: [Issue]122- **WCAG Criterion:** [Number and description]123- **Impact:** [Screen readers, keyboard users, low vision]124- **Location:** [Component:line]125- **Fix:** [Specific recommendation]126127### Screen Reader Testing128- **NVDA:** [Pass/Fail with notes]129- **JAWS:** [Pass/Fail with notes]130- **VoiceOver:** [Pass/Fail with notes]131132### Verdict133- [ ] APPROVED (WCAG 2.1 AA compliant)134- [ ] MINOR_ISSUES (usable, improvements recommended)135- [ ] MAJOR_ISSUES (blocks compliance, must fix)136```137138## Examples139140### Example: Inaccessible Form141142**⌠Before (Non-compliant):**143```html144<form>145 <input type="text" placeholder="Username">146 <input type="password" placeholder="Password">147 <div style="color: red;">Invalid credentials</div>148 <span onclick="submit()">Submit</span>149</form>150```151152**Issues:**1531. No labels (WCAG 3.3.2)1542. Error not associated with input (WCAG 3.3.1)1553. Submit not keyboard accessible (WCAG 2.1.1)1564. No focus indicators157158**✅ After (Compliant):**159```html160<form>161 <div>162 <label for="username">Username</label>163 <input164 id="username"165 type="text"166 aria-describedby="username-error"167 aria-invalid="true"168 >169 <span id="username-error" role="alert">170 Invalid credentials. Please check your username and password.171 </span>172 </div>173174 <div>175 <label for="password">Password</label>176 <input177 id="password"178 type="password"179 aria-describedby="password-hint"180 >181 <span id="password-hint">182 Must be at least 8 characters183 </span>184 </div>185186 <button type="submit">Submit</button>187</form>188189<style>190 input:focus, button:focus {191 outline: 2px solid blue;192 outline-offset: 2px;193 }194</style>195```196197**Improvements:**198- Explicit `<label>` elements (WCAG 3.3.2) ✓199- `aria-invalid` and `aria-describedby` for errors (WCAG 3.3.1) ✓200- `<button>` for keyboard accessibility (WCAG 2.1.1) ✓201- Visible focus indicators (WCAG 2.4.7) ✓202203## References204205- [WCAG 2.2 Success Criteria](references/wcag-2.2-success-criteria.md) — Key Level A/AA criteria quick reference206- [ARIA Patterns](references/aria-patterns.md) — Common patterns, anti-patterns, and code examples207208### External references209210- **WCAG 2.2:** https://www.w3.org/WAI/WCAG22/quickref/211- **ARIA Practices:** https://www.w3.org/WAI/ARIA/apg/212- **Testing Tools:** axe DevTools, WAVE, Pa11y