HTML Concepts: Focusable Areas

Post from May 30, 2022, filed under  (feed).

When you hear “focusable area,” what comes to your mind? Anchors and form elements that receive focus when being “tabbed through,” i.e., that are highlighted and that can be interacted with?

That’s not a bad description!—but also not a complete one.

As always, the HTML specification deserves having a closer look at. (The spec is dry and intimidating, but consider reading it, if you haven’t.)

A focusable area in the HTML specification’s section on focusable areas.

Figure: Focusable areas meta.

Focusable Areas

So according to the spec, what can be focusable areas?

Quite generally speaking, elements that have a tabindex and that are being rendered are focusable areas.

As so much here depends on tabindex, what is that attribute about?


Its purpose is exactly what we’re covered here—to manage focusable areas.

Quoting the spec, the tabindex attribute “allows authors to make an element and regions that have the element as its DOM anchor be focusable areas, allow or prevent them from being sequentially focusable, and determine their relative ordering for sequential focus navigation.”

If the value of tabindex is omitted, the user agent determines whether the respective element is focusable.

A negative value makes an element focusable (but click-focusable, and not sequentially focusable, a difference the HTML spec also explains).

A value of 0 makes the element focusable.

A positive value (integer) makes the respective element focusable, but also defines the tab order, in that higher tabindex values mean elements to be focused later.

DOM Anchors

Yet this is not it; an important detail around focusable areas relates to DOM anchors, which determine the position of the focusable area in the DOM:

Each focusable area has a DOM anchor, which is a Node object that represents the position of the focusable area in the DOM. (When the focusable area is itself a Node, it is its own DOM anchor.) The DOM anchor is used in some APIs as a substitute for the focusable area when there is no other DOM object to represent the focusable area.

The focusable areas above each come with a particular DOM anchor; usually, the element itself, but for image maps, the img element, and for sub-widgets, the element it was created for.

❧ Focusable areas—more complex than they sound like, still not as hard in hindsight. Check out other aspects of HTML in the HTML concepts series!

Toot or tweet about this?

About Me

Jens Oliver Meiert, on September 30, 2021.

I’m Jens, and I’m an engineering lead and author. I’ve worked as a technical lead for Google, I’m close to W3C and WHATWG, and I write and review books for O’Reilly. I love trying things, sometimes including philosophy, art, and adventure. Here on I share some of my views and experiences.

If you have a question or suggestion about what I write, please leave a comment (if available) or a message. Thank you!