Web accessibility ensures your content is usable by everyone, including people with disabilities. Beyond being the right thing to do, it's often legally required and improves SEO. This guide covers practical WCAG 2.2 implementation.
Core Principles
- Perceivable: Content can be perceived through different senses
- Operable: Interface can be operated with various input methods
- Understandable: Content and operation are understandable
- Robust: Content works across different technologies
Semantic HTML
<!-- Good: Semantic structure -->
<header>
<nav aria-label="Main navigation">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/products">Products</a></li>
</ul>
</nav>
</header>
<main>
<article>
<h1>Page Title</h1>
<p>Content...</p>
</article>
</main>
<footer>
<nav aria-label="Footer navigation">...</nav>
</footer>
<!-- Form accessibility -->
<form>
<div>
<label for="email">Email address</label>
<input
id="email"
type="email"
required
aria-describedby="email-hint"
/>
<span id="email-hint">We'll never share your email</span>
</div>
<button type="submit">Subscribe</button>
</form>ARIA Patterns
// Accessible modal component
function Modal({ isOpen, onClose, title, children }) {
const modalRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (isOpen) {
// Trap focus in modal
modalRef.current?.focus();
document.body.style.overflow = 'hidden';
}
return () => {
document.body.style.overflow = '';
};
}, [isOpen]);
if (!isOpen) return null;
return createPortal(
<div
role="dialog"
aria-modal="true"
aria-labelledby="modal-title"
ref={modalRef}
tabIndex={-1}
onKeyDown={(e) => e.key === 'Escape' && onClose()}
>
<h2 id="modal-title">{title}</h2>
{children}
<button onClick={onClose} aria-label="Close modal">
<XIcon aria-hidden="true" />
</button>
</div>,
document.body
);
}Testing Checklist
Accessibility Testing
Automated:
- Run axe DevTools
- Use Lighthouse accessibility audit
- Integrate axe-core in CI/CD
Manual:
- Navigate with keyboard only
- Test with screen reader (NVDA/VoiceOver)
- Check color contrast ratios
- Verify focus indicators
Conclusion
Accessibility should be built in from the start, not added later. Focus on semantic HTML, proper ARIA usage, and regular testing to create inclusive web experiences.
Need help with accessibility compliance? Contact Jishu Labs for expert accessibility consulting and audits.
About Emily Zhang
Emily Zhang is the Frontend Lead at Jishu Labs with deep expertise in accessible web development.