Accessibility & WCAG 2.2 Compliance
Practical guide to building accessible web interfaces that meet WCAG 2.2 AA conformance.
Why
Inaccessible interfaces exclude 15% of users with disabilities, create legal liability (ADA, EAA), and degrade SEO since search engines cannot parse ARIA-misused content. Accessibility is not optional.
The WebAIM Million 2024 report found 96.3% of homepages had detectable WCAG failures. ADA-related lawsuits exceeded 4,500 in 2023, making accessibility a legal and ethical necessity, not a nice-to-have.
When
Always. Accessibility must be built in from the first component, not retrofitted before launch. Audit existing UI immediately if it was built without a11y consideration.
How
Example
Common Problems
- ⚠Using role='button' on a <div> — should use a real <button> for keyboard support
- ⚠aria-label overrides visible text — screen readers lose the button's text content
- ⚠Positive tabindex (tabindex='1') — breaks natural tab order, use tabindex='-1' or '0'
- ⚠Missing focus-visible styles — keyboard users cannot see where focus is
Best Practices
- ✓Prefer semantic HTML over ARIA — ARIA is a last resort, not a first choice
- ✓Run axe-core in CI — fail the build on new violations, not just warnings
- ✓Test with real screen readers — automated tools catch 40% of issues at most
- ✓Use prefers-reduced-motion media query — disable animations for vestibular sensitivity
FAQ
Do I need ARIA on every element for accessibility?
No — prefer semantic HTML (<button>, <nav>, <label>). ARIA is a last resort when HTML can't express the pattern. Overusing ARIA often makes things worse.
What WCAG 2.2 level should I target?
AA is the legal and practical baseline (ADA, EAA compliance). Aim for AA across the product, AAA on critical flows like checkout where feasible.
How do I test accessibility beyond automated tools?
axe-core catches ~40% of issues. Test the rest with a real screen reader (NVDA/VoiceOver) and keyboard-only navigation — every interactive element must be reachable and operable.
What color contrast ratio do I need?
4.5:1 for normal text, 3:1 for large text (≥18px or 14px bold) and UI components. Use a contrast checker in your design tool, not just eyeballing.
How do I handle focus management in modals?
Trap focus inside the modal while open, restore focus to the trigger on close. Use aria-modal='true' and listen for Escape to close.