Sent on Mar 18, 2020

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:

  1. Using element.focus and tabindex
  2. 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:

  1. How to use the element.focus method
  2. How to use the aria-activedescendant method
  3. A series of tests on how element.focus and aria-activedescendant works.
  4. Why I recommend element.focus over aria-activedescendant (in short, it’s more reliable and easier to use).

Here’s the article again.

Enjoy!

Stay awesome,
Zell