Approach summary: target WCAG 2.1 AA, ensure semantic markup + keyboard operability + ARIA where needed, test automatically and manually, gate via CI and PR checklist.
Automated tests
- Unit/axe: use jest-axe to run axe against component render.
- E2E/axe: run cypress-axe in integration tests to test real DOM and interactions (focus, tooltips).
- CI/CLI: run axe-core CLI or pa11y-ci and Lighthouse CI to fail builds on violations.
Example (jest-axe):
javascript
import React from 'react';
import { render } from '@testing-library/react';
import { toHaveNoViolations } from 'jest-axe';
import { axe } from 'jest-axe';
import Chart from './Chart';
expect.extend(toHaveNoViolations);
test('chart is accessible', async () => {
const { container } = render(<Chart data={sample} />);
const results = await axe(container);
expect(results).toHaveNoViolations();
});
Manual keyboard & screen reader checks
- Keyboard: Tab/Shift+Tab, Arrow keys, Enter/Space to activate points/legend; ensure logical focus order, visible focus styles, skip-to controls for dense charts.
- Screen reader: NVDA/JAWS (Windows), VoiceOver (mac/iOS). Verify announcements for chart role, accessible name/description, data point labels on focus, summary for large datasets.
- Mobile: TalkBack/VoiceOver checks for touch focus/gesture semantics.
Tools
- axe DevTools / browser extension, Accessibility Insights, Lighthouse, Color Contrast Analyzer, NVDA/VoiceOver, cypress-axe, jest-axe, pa11y.
Acceptance criteria (examples)
- No automated axe violations at AA level for component interactions.
- Keyboard: all interactive elements reachable and operable; focus visible.
- Screen reader: chart has accessible name/description; selecting a data point announces value, label, and index.
- Color contrast >= 4.5:1 for text; non-text contrast >=3:1 where applicable.
- Performance: tooltips/readouts do not block navigation.
CI and PR integration
- Add jest-axe unit tests and cypress-axe E2E to CI; fail build on regressions.
- Run Lighthouse/pa11y in CI weekly or per-merge for full pages.
- Enforce accessibility linting (eslint-plugin-jsx-a11y) and pre-commit hooks.
- PR template includes an a11y checklist: automated tests passing, keyboard + screen reader verification notes, screenshots/GIFs of keyboard flow or VoiceOver output for complex changes.
- Use incremental remediation: triage axe violations in PR, require dev to fix or document exception with product/UX sign-off.
Reasoning: Combining automated and manual checks catches structural issues (axe), runtime/interaction issues (E2E + manual keyboard), and real assistive-technology behaviors (screen reader). CI + PR policies ensure regressions are caught early and accessibility is treated as part of quality, not an afterthought.