| name | accessibility-check |
| description | Web accessibility audit workflow for WCAG compliance |
| license | MIT |
Accessibility Check Skill
Use this skill when auditing or improving web accessibility compliance.
When to Use
- Building new UI components
- Auditing existing features
- Before major releases
- After accessibility complaints
- Regular a11y reviews
WCAG 2.1 Levels
| Level | Description | Target |
|---|
| A | Minimum accessibility | Required |
| AA | Standard compliance | Recommended |
| AAA | Enhanced accessibility | Ideal |
Quick Checks
1. Keyboard Navigation
<button onClick={handleClick}>Click me</button>
<div onClick={handleClick}>Click me</div>
<div
role="button"
tabIndex={0}
onClick={handleClick}
onKeyDown={(e) => e.key === 'Enter' && handleClick()}
>
Click me
</div>
2. Screen Reader Testing
3. Color Contrast
.text {
color: #999;
background: #fff;
}
.text {
color: #595959;
background: #fff;
}
Common Issues & Fixes
Images
<img src="product.jpg" />
<img src="product.jpg" alt="Red wireless headphones" />
<img src="divider.svg" alt="" role="presentation" />
<figure>
<img src="chart.png" alt="Q4 sales chart" aria-describedby="chart-desc" />
<figcaption id="chart-desc">
Sales increased 45% from October to December,
with November showing the highest growth.
</figcaption>
</figure>
Forms
<input type="email" placeholder="Email" />
<label htmlFor="email">Email address</label>
<input type="email" id="email" />
<label htmlFor="email">Email address</label>
<input
type="email"
id="email"
aria-invalid="true"
aria-describedby="email-error"
/>
<span id="email-error" role="alert">
Please enter a valid email address
</span>
<label htmlFor="name">
Name <span aria-hidden="true">*</span>
</label>
<input type="text" id="name" required aria-required="true" />
Buttons & Links
<button><Icon name="close" /></button>
<button aria-label="Close dialog">
<Icon name="close" aria-hidden="true" />
</button>
<a href="/docs">Click here</a>
<a href="/docs">Read the documentation</a>
<a href="/external" target="_blank" rel="noopener noreferrer">
External site
<span className="sr-only">(opens in new tab)</span>
</a>
Headings
<h1>Page Title</h1>
<h3>Section</h3> {}
<h1>Page Title</h1>
<h2>Section</h2>
<h3>Subsection</h3>
Focus Management
button:focus-visible {
outline: 2px solid #005fcc;
outline-offset: 2px;
}
import { FocusTrap } from '@headlessui/react';
function Modal({ children }) {
return (
<FocusTrap>
<div role="dialog" aria-modal="true" aria-labelledby="modal-title">
<h2 id="modal-title">Modal Title</h2>
{children}
</div>
</FocusTrap>
);
}
const triggerRef = useRef();
function openModal() {
triggerRef.current = document.activeElement;
setIsOpen(true);
}
function closeModal() {
setIsOpen(false);
triggerRef.current?.focus();
}
Skip Links
<a href="#main-content" className="skip-link">
Skip to main content
</a>
<nav aria-label="Main navigation">...</nav>
<main id="main-content" tabIndex={-1}>
...
</main>
.skip-link {
position: absolute;
left: -9999px;
z-index: 999;
}
.skip-link:focus {
left: 50%;
transform: translateX(-50%);
top: 10px;
padding: 8px 16px;
background: #000;
color: #fff;
}
Live Regions
<div aria-live="polite" aria-atomic="true">
{statusMessage}
</div>
<div role="alert">
Error: Your session has expired.
</div>
function SearchResults({ isLoading, results }) {
return (
<>
<div aria-live="polite" className="sr-only">
{isLoading ? 'Loading results...' : `Found ${results.length} results`}
</div>
{/* Visual content */}
</>
);
}
Testing Tools
npm install @axe-core/react jest-axe
import React from 'react';
import ReactDOM from 'react-dom';
import axe from '@axe-core/react';
if (process.env.NODE_ENV !== 'production') {
axe(React, ReactDOM, 1000);
}
import { axe, toHaveNoViolations } from 'jest-axe';
expect.extend(toHaveNoViolations);
test('should have no a11y violations', async () => {
const { container } = render(<MyComponent />);
expect(await axe(container)).toHaveNoViolations();
});
Browser Extensions
| Tool | Purpose |
|---|
| axe DevTools | Comprehensive testing |
| WAVE | Visual evaluation |
| HeadingsMap | Heading structure |
| Landmarks | ARIA landmarks |
Screen Reader Only CSS
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
Audit Checklist
Perceivable
Operable
Understandable
Robust
Report Template
## Accessibility Audit
### Summary
- Issues found: 12
- Critical: 3
- Serious: 5
- Moderate: 4
### Critical Issues
#### Missing form labels
**Location**: Login form
**WCAG**: 1.3.1, 4.1.2
**Impact**: Screen reader users cannot identify fields
**Fix**:
```html
<label for="email">Email</label>
<input id="email" type="email">
Recommendations
- Add eslint-plugin-jsx-a11y
- Include a11y in PR checklist
- Test with screen reader monthly