Why Should You Care About WAI-ARIA?
Alright, let’s be real. Web accessibility is important, but it’s also one of those things developers often get wrong.
WAI-ARIA (Web Accessibility Initiative - Accessible Rich Internet Applications) is a fancy name for a set of rules that make sure people using assistive technologies—like screen readers—can actually use your web app.
Sounds great, right?
Well, it is—if you use it correctly. The problem? Bad ARIA is worse than no ARIA. So let’s go over how to use it without making things worse.
The Golden Rules of ARIA
Before we get into the nitty-gritty, keep these simple rules in mind:
Use HTML First
- If you can use a native HTML element (
<button>
,<input>
,<label>
), do that instead of ARIA. - HTML is already accessible—ARIA is just a backup plan.
- If you can use a native HTML element (
Don’t Mess With Native Accessibility
- Some elements come with built-in magic.
- If you set
role="presentation"
orrole="none"
on something important, you might break it.
Keyboard Navigation is a Must
- If people can’t use your app with just a keyboard, you’re doing it wrong.
- Make sure every interactive element can be reached and activated without a mouse.
Control Focus Like a Pro
- Users should never get lost.
- Use
tabindex
wisely and make sure focus moves logically through your interface.
Keep ARIA Up to Date
- If something changes (like a dropdown opening), update your ARIA attributes so assistive tech knows what’s happening.
How to Use ARIA Without Breaking Everything
ARIA Roles: What Are They?
Roles tell screen readers what an element is supposed to be. Here are some you’ll actually use:
role="button"
→ For when you’re making a button out of something that isn’t a<button>
(but… why not just use a<button>
?)role="alert"
→ When you need something read out loud ASAProle="dialog"
→ For modals and popupsrole="tabpanel"
→ For making accessible tabs
Example:
|
|
ARIA States and Properties: Keeping Users in the Loop
ARIA states and properties tell assistive tech what’s going on with an element.
Example: Making a Toggle Button That Actually Works
|
|
Common ARIA Mistakes That Make the Internet Worse
🚨 Please don’t do these things:
Slapping ARIA on Everything
- If you can use a native HTML element, just use it.
<div role="button">
is not better than<button>
.
Forgetting to Update ARIA States
- If a dropdown opens but
aria-expanded
still saysfalse
, assistive tech users will be very confused.
- If a dropdown opens but
Making ARIA Widgets Impossible to Use with a Keyboard
- If your custom dropdown doesn’t support the arrow keys, you’ve failed.
Misusing
aria-hidden
- If something is visible and important, do NOT set
aria-hidden="true"
on it. - That makes it invisible to screen readers.
- If something is visible and important, do NOT set
How to Do ARIA Right
- Use ARIA only when absolutely necessary.
- Keep ARIA attributes updated—especially for interactive elements.
- Test your site with a screen reader. NVDA, JAWS, and VoiceOver are your best friends.
- Follow the WAI-ARIA Authoring Practices for proven patterns that actually work.