Hajime, the duck guy

Tuesday, April 2, 2024, by Hajime Yamasaki Vukelic

Do you know what alert role does in a screen reader?

No? Well, don't use it then.

ARIA is not just for show

When you use the role="alert" without fully understanding it, you can make your UI obnoxiously confusing to screenreader users. Yes, both obnoxious and confusing. Imagine you walk into a hotel, and someone yells at you "The TV in room 103 is set to channel 52." for no apparent reason. And then repeats that for every room in the hotel. That's what it looks like.

No ARIA is better than wrong ARIA

Don't use any ARIA attribute if you don't know how to test its effect. ARIA attributes are actually used by accessibility technologies. They're not just for show. Using the wrong ARIA attribute is worse than not using any.

Stick to native controls and built-in tag semantics. ARIA attributes are really intended for cases where you're bending the HTML a bit too far. I know it's sometimes just a skill issue, but I also know that... yes, the UX designer is looking at you right now. Just give your UX designer some accessibility training. They should receive it anyway. UX people generally do care about users, they sometimes just don't know their users well enough. Make it work!

Naturally, you can't always avoid custom controls. However, if you master built-in ones 100%, you'll build better-quality custom controls, and you'll still be able to avoid ARIA 100% of the time. (For me it's 80%. I just don't know how to do 100% yet. It's a skill issue.)

Learn how to test

Learning how to test ARIA attributes isn't that hard. It's similar to cross-browser testing. In fact, it is cross-browser testing if you treat accessibility technologies as a "browser". Start with WCAG guidelines, and make sure you understand them. Then find tools to test for the success criteria, like WAVE and NVDA (Apple computers have an ok built-in screen reader, as do smartphones). Don't just blindly follow what the tool says, though... see what I did there?

Posted in Programming tips
Back to top