---
name: a11y-annotation-generator
description: Adds accessibility annotations (ARIA labels, roles, alt text) to make web content accessible. Use when user asks to "add accessibility", "make accessible", "add aria labels", "wcag compliance", or "screen reader support".
allowed-tools: [Read, Write, Edit, Glob, Grep]
---
# Accessibility Annotation Generator
Automatically adds ARIA labels, roles, alt text, and other accessibility annotations to HTML/JSX/Vue templates.
## When to Use
- "Make this component accessible"
- "Add ARIA labels"
- "Add alt text to images"
- "Make accessible for screen readers"
- "Add accessibility annotations"
- "WCAG compliance"
## Instructions
### 1. Scan for Accessibility Issues
Analyze HTML/JSX/Vue files for common issues:
```bash
# Find images without alt text
grep -r "
// After
// Decorative images (no alt needed, but must be explicit)
```
**Background images (CSS):**
```jsx
// Add ARIA label for meaningful background images
```
### 3. Add ARIA Labels to Interactive Elements
**Buttons:**
```jsx
// Before
// After
// Or with visible text
```
**Icon-only buttons:**
```jsx
// Before
// After
```
**Links:**
```jsx
// Before
// After
// Avoid generic "click here"
// Before
Click here
// After
Read the documentation
```
### 4. Add Form Accessibility
**Labels for inputs:**
```jsx
// Before
// After - Method 1: Visible label (preferred)
// After - Method 2: aria-label (if no visible label)
```
**Error messages:**
```jsx
// Before
{error && {error}}
// After
{error && (
{error}
)}
```
**Required fields:**
```jsx
```
**Field descriptions:**
```jsx
Must be at least 8 characters with 1 uppercase letter and 1 number
```
### 5. Add Semantic HTML and Roles
**Navigation:**
```jsx
// Before
)
}
```
**Vue:**
```vue
```
### Best Practices
**DO:**
- Use semantic HTML first (button, not div with onClick)
- Provide visible labels when possible
- Use aria-label only when no visible label
- Test with keyboard only (no mouse)
- Test with screen reader (NVDA, JAWS, VoiceOver)
- Maintain focus order that makes sense
- Announce dynamic changes
**DON'T:**
- Use positive tabIndex (except -1 for programmatic focus)
- Hide content that should be accessible
- Use color alone to convey information
- Create keyboard traps
- Disable zoom/pinch
- Remove focus outlines without replacement
### Testing Checklist
- [ ] All images have alt text
- [ ] All buttons/links have labels
- [ ] All form inputs have labels
- [ ] Keyboard navigation works
- [ ] Focus visible on all elements
- [ ] Color contrast meets WCAG AA (4.5:1)
- [ ] Screen reader announces content correctly
- [ ] No keyboard traps
- [ ] Skip links work
- [ ] ARIA roles/labels correct
- [ ] Live regions announce updates
- [ ] Modals trap focus correctly
- [ ] Errors announced to screen reader