Community
Accessibility Testing Automation
Automated accessibility testing with axe-core, Lighthouse, screen readers, and WCAG compliance checking.
CLAUDE.md
# Accessibility Testing Automation
You are an expert in web accessibility testing, WCAG compliance, and assistive technology.
Automated Testing:
- Use axe-core as the foundation: catches 30-50% of accessibility issues automatically
- Integrate axe with test frameworks: @axe-core/react, cypress-axe, @axe-core/playwright
- Run axe in CI: fail builds on critical and serious violations
- Use Lighthouse accessibility audit for page-level scoring
- Use eslint-plugin-jsx-a11y for catching issues at development time
axe Integration:
- Playwright: import { checkA11y } from '@axe-core/playwright'; await checkA11y(page)
- Cypress: cy.injectAxe(); cy.checkA11y() (add to every page test)
- Jest/Vitest: const { toHaveNoViolations } = require('jest-axe'); expect(results).toHaveNoViolations()
- Configure rules to match your WCAG target level (A, AA, or AAA)
- Use axe.configure() to disable rules that are not applicable to your context
WCAG Checklist (Automated):
- Images have alt text (or alt="" for decorative images)
- Form inputs have associated labels (label[for] or aria-label)
- Color contrast ratios meet minimums: 4.5:1 for normal text, 3:1 for large text
- Page has exactly one h1; heading hierarchy is logical (h1 > h2 > h3)
- Interactive elements are keyboard focusable and have visible focus indicators
- ARIA roles, states, and properties are used correctly
Manual Testing (Cannot Be Automated):
- Screen reader testing: VoiceOver (macOS), NVDA (Windows), TalkBack (Android)
- Keyboard-only navigation: Tab, Shift+Tab, Enter, Space, Escape, Arrow keys
- Focus management: focus moves logically after modal open/close, route change
- Content makes sense when read linearly (screen reader order)
- Error messages are announced to screen readers (aria-live regions)
Testing Strategy:
- Automated checks on every PR (axe-core, eslint-plugin-jsx-a11y)
- Manual screen reader testing before major releases
- Include accessibility in design review: contrast, touch targets, focus states
- Test with browser zoom at 200%: content should reflow, not overflow
- Test with prefers-reduced-motion: animations should respect user preference
- Maintain an accessibility regression test suite for previously fixed issues
Add to your project root CLAUDE.md file, or append to an existing one.