Building Accessible Web Applications: A Frontend Developer's Guide to WCAG 2.1 AA
Accessibility is not an edge case. 15% of the world's population lives with some form of disability. As frontend developers, building inclusive experiences is our responsibility — and it makes for better products for everyone.
In my work as a frontend developer in Ahmedabad, I've integrated accessibility into projects ranging from corporate websites to complex dashboards. Here's what I've learned.
Start with Semantic HTML
The most powerful accessibility tool is already in your toolbox: semantic HTML. A screen reader user navigating by heading can jump directly to content sections. A user navigating by landmark can find the <nav>, <main>, and <footer> instantly.
<!-- Bad -->
<div class="header">...</div>
<div class="nav">...</div>
<div class="content">...</div>
<!-- Good -->
<header>...</header>
<nav aria-label="Main navigation">...</nav>
<main>...</main>
Work with the platform, not against it. Browsers already understand how to expose semantic elements to assistive technology.
Keyboard Navigation is Non-Negotiable
Every interactive element must be reachable and operable via keyboard. This means:
- Focus management: Trap focus in modals, restore focus when they close
- Visible focus indicators: Never use
outline: nonewithout a replacement - Logical tab order: Match the visual order with the DOM order
- Skip links: Provide a "Skip to content" link as the first focusable element
<a href="#main-content" class="skip-link">
Skip to content
</a>
ARIA: Use Only When HTML Falls Short
The first rule of ARIA is: don't use ARIA if native HTML can do the job. A <button> is infinitely better than a <div role="button">.
<!-- Don't do this -->
<div role="button" tabindex="0" onclick="...">Click me</div>
<!-- Do this instead -->
<button onclick="...">Click me</button>
Use ARIA for complex widgets that HTML can't express natively: tabs, accordions, live regions, and custom selects.
Test with Real Tools
Automated tools catch ~30% of issues. Manual testing catches the rest:
- axe DevTools: Browser extension for automated checks
- VoiceOver / NVDA: Test with actual screen readers
- Tab through your app: Can you reach and operate everything?
- Zoom to 200%: Does the layout hold up?
- WAVE: Visual overlay showing ARIA roles and structural issues
On a recent mobility platform project, systematic accessibility testing helped us achieve 97% WCAG 2.1 AA compliance while maintaining a 92 Lighthouse Performance score on mobile.
Key Takeaways
- Semantic HTML solves 70% of accessibility problems before you write a single ARIA attribute
- Keyboard accessibility is the foundation — if you can't tab through it, it's broken
- Test with real assistive technology, not just automated tools
- Accessibility improves SEO, usability, and brand perception — it's not just compliance
Written by Bhavya Panchal — Frontend Developer & UI Engineer
WORK WITH ME