Element.focus vs aria-activedescendant
When you build JavaScript components, you need to manage focus for both keyboard users and screen readers. The WAI-ARIA specs say there are two ways to manage focus:
- Using element.focus and tabindex
- Using aria-activedesecndant
Which should you use and why?
I did in-depth research on these two methods and I’d like to share my findings with you today. Take a seat and grab some popcorn. It’s gonna get interesting.
Click here to read the article.
What you’ll learn:
- How to use the element.focus method
- How to use the aria-activedescendant method
- A series of tests on how element.focus and aria-activedescendant works.
- Why I recommend element.focus over aria-activedescendant (in short, it’s more reliable and easier to use).
Enjoy!
Stay awesome,
Zell