* Initial plan * feat: Implement CLI tool with init, upload, and verify commands Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com> * fix: Resolve linting issues and add CLI-specific eslint config Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com> * refactor: Address code review feedback - improve validation, memory efficiency, and type safety Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com>
7.4 KiB
7.4 KiB
Accessibility Testing Guide
This guide explains how to test the accessibility features of Internet-ID and ensure WCAG 2.1 Level AA compliance.
Quick Start
Run all accessibility checks:
npm run audit:a11y # Run automated code audit
npm run test:a11y # Run Playwright accessibility tests
npm run perf:audit # Run Lighthouse audit (includes accessibility)
Automated Testing
1. Code-Level Audit
Run the custom accessibility audit script:
npm run audit:a11y
This checks for:
- ARIA labels on buttons
- Alt text on images
- Form input labels
- ARIA live regions
- Semantic role attributes
2. End-to-End Accessibility Tests
Run comprehensive Playwright tests:
# Run all accessibility tests
npm run test:a11y
# Run with UI mode for debugging
npm run test:e2e:ui -- 07-accessibility.spec.ts
# Run in headed mode to see the browser
npm run test:e2e:headed -- 07-accessibility.spec.ts
The test suite covers:
- Document structure and landmarks
- Heading hierarchy
- Skip-to-content link
- Keyboard navigation
- ARIA attributes
- Focus management
- Color contrast (visual)
- Mobile accessibility
- Screen reader support
3. Lighthouse Audit
Run a full Lighthouse audit including accessibility:
# Run full audit (requires app to be running)
npm run perf:audit
# Or collect data only
npm run perf:collect
Lighthouse checks:
- Accessibility score (must be 90+)
- ARIA attribute validity
- Color contrast ratios
- Image alt text
- Form labels
- Navigation structure
Manual Testing
Keyboard Navigation Testing
-
Tab Navigation
- Press
Tabto move forward through interactive elements - Press
Shift + Tabto move backward - Verify all interactive elements can be reached
- Verify focus indicators are clearly visible
- Press
-
Skip to Content
- Press
Tabon page load - Verify "Skip to main content" link appears
- Press
Enterto activate - Verify page scrolls to main content
- Press
-
Keyboard Shortcuts
Escape: Close toast notificationsEnter/Space: Activate buttons and links- Arrow keys: Navigate within components (where applicable)
Screen Reader Testing
Testing with NVDA (Windows)
- Download and install NVDA
- Start NVDA (Ctrl + Alt + N)
- Navigate to the application
- Use the following commands:
H: Navigate by headingTab: Move through interactive elementsInsert + F7: List of elementsInsert + Down Arrow: Read content
Testing with JAWS (Windows)
- Download and install JAWS
- Start JAWS
- Navigate to the application
- Use the following commands:
H: Navigate by headingTab: Move through interactive elementsInsert + F6: List of headingsInsert + Down Arrow: Read content
Testing with VoiceOver (macOS)
- Enable VoiceOver (Cmd + F5)
- Navigate to the application in Safari
- Use the following commands:
VO + Right Arrow: Navigate forwardVO + Left Arrow: Navigate backwardVO + H: Navigate by headingVO + Space: Activate elementVO + U: Open rotor menu
Testing with TalkBack (Android)
- Enable TalkBack in Settings > Accessibility
- Open the application in Chrome
- Swipe right to navigate forward
- Swipe left to navigate backward
- Double-tap to activate elements
Color Contrast Testing
Using Browser DevTools
- Open Chrome DevTools (F12)
- Select an element with text
- In the Styles panel, click the color square
- Check the "Contrast ratio" section
- Verify:
- Normal text: 4.5:1 minimum
- Large text (18pt+): 3:1 minimum
Using Online Tools
Focus Indicator Testing
- Use keyboard to navigate through all interactive elements
- Verify each focused element has:
- Clear, visible outline (3px solid blue)
- Sufficient contrast with background (3:1 minimum)
- Consistent styling across the application
Accessibility Checklist
Use this checklist when implementing new features:
Semantic HTML
- Use proper heading hierarchy (h1, h2, h3, etc.)
- Use semantic elements (main, nav, section, article, etc.)
- Use landmark roles or ARIA landmarks
ARIA Attributes
- Add aria-label to icons and icon-only buttons
- Use aria-live for dynamic content updates
- Use aria-pressed for toggle buttons
- Use role="alert" for error messages
- Use role="status" for loading indicators
Forms
- All inputs have associated labels
- Required fields are marked with aria-required
- Error messages are linked with aria-describedby
- Form validation provides clear feedback
Keyboard Navigation
- All interactive elements are keyboard accessible
- Focus indicators are visible and clear
- Tab order is logical
- Escape key closes modals/dialogs
Images and Media
- All images have descriptive alt text
- Decorative images use alt="" or aria-hidden="true"
- Complex images have detailed descriptions
Color and Contrast
- Text meets 4.5:1 contrast ratio (normal text)
- Large text meets 3:1 contrast ratio (18pt+)
- Interactive elements meet 3:1 contrast ratio
- Color is not the only way to convey information
Dynamic Content
- Loading states are announced to screen readers
- Success/error messages are announced
- Content updates don't cause unexpected focus changes
Common Issues and Solutions
Issue: Focus indicator not visible
Solution: Ensure CSS includes proper focus styles:
*:focus-visible {
outline: 3px solid #1d4ed8;
outline-offset: 2px;
}
Issue: Screen reader not announcing updates
Solution: Add aria-live region:
<div aria-live="polite" aria-atomic="true">
{message}
</div>
Issue: Button without accessible name
Solution: Add aria-label:
<button aria-label="Close dialog" onClick={onClose}>
×
</button>
Issue: Form input without label
Solution: Associate label with input:
<label htmlFor="email-input">Email</label>
<input id="email-input" type="email" />
Resources
Official Guidelines
Testing Tools
Learning Resources
Reporting Issues
If you find an accessibility issue:
- Check if it's already reported in GitHub Issues
- Create a new issue with:
- Description of the problem
- Steps to reproduce
- Expected behavior
- Actual behavior
- Assistive technology used (if applicable)
- Screenshots/recordings
Continuous Improvement
Accessibility is an ongoing effort. We:
- Run automated tests in CI/CD pipeline
- Perform manual testing for major releases
- Review accessibility in code reviews
- Update this documentation as we learn
For questions, contact: support@subculture.io