In brief

  • Focusable UI elements split into two kinds: those reached in sequence with the tab key, and those that can only receive focus programmatically.
  • Sequentially focusable elements are reached with the tab key, while programmatically focusable elements receive focus through JavaScript's focus() function or a fragment identifier.
  • A negative tabindex makes an element programmatically focusable without adding it to the tab sequence.

Why it's worth reading: An accessibility specialist's clear breakdown of which UI elements receive keyboard focus and why audit tools disagree

Summary by Mosaic, Designed's AI · may contain mistakes

In accessibility, “focusable” UI elements are represented by two separate yet equally important concepts: the elements who can be focused sequentially and those who can only receive focus programmatically. These are their stories. Dun-Dun

While working for a client the other day, I found that Polypane[^ Affiliate link.], which is excellent in locating accessibility issues, showed elements with tabindex="-1" as focusable in the Focus Order section of the Outline tool.

I contacted Kilian to see why that was happening, and he pointed me to the Accessibility Tree, which showed the element as focusable, too.

This is where I understood that there was a mix-up between two concepts: Sequentially focusable and programmatically focusable elements. The former are elements that can be reached with the tab key. Mixing these concepts is easy, as we use “focusable” because it is short and because the concepts are somewhat related. But for accessibility testing and understanding why we see certain behavior, understanding the difference is important.

What are sequentially focusable elements?

For elements without a tabindex attribute, the HTML spec has the following list of sequentially focusable elements:

a elements that have an href attribute button elements input elements whose type attribute are not in the Hidden state select elements textarea elements summary elements that are the first summary element child of a details element

Elements with a draggable attribute set, if that would enable the user agent to allow the user to begin drag operations for those elements without the use of a pointing device

Editing hosts

Navigable containers

In addition, elements with a tabindex attribute of 0 are also part of the sequentially focusable elements.

Elements with a positive tabindex attribute are also part of the sequentially focusable elements, but reorder the sequence[^ Note that positive tabindex values are always sorted to the top of the sequence.

ProductAccessibilityUI

0 Comments

Sign in to join the discussion.

Be the first to comment.

← Back to Designed News