For the last couple of months (yes, sorry…) I’ve investigated the domain of “sequential navigation” (what you do, when you hit Tab). What follows are a couple of ideas regarding the Element-level focus APIs from an author’s (“web developer”) perspective.
- There is no simple way to find out if an element is focusable or tabbable (i.e. accessible through sequential navigation). Since user agents already maintain internal focusable flags per element and the sequential navigation list, exposing the readonly boolean properties
tabbablelooks like a small feat.
- Additionally to (1) the flags could be made accessible via CSS pseudo-classes
- Alternatively or additionally to (1) the ElementCollections of focusable and tabbable child elements should be made available per element. This is useful to do things like (4) manually. user agents vary on what is focusable/tabbable and figuring this out accurately is cumbersome.
- WAI ARIA Authoring Practices for Modal Dialogs says “Tab Focus must be held within the dialog until it is cancelled or submitted”. This is true for Chrome’s implementation of the
- The document-wide nature of positive tabindex attributes (e.g. [tabindex=“3”]) make localized re-ordering of the navigation sequence painfully hard. The ShadowDOM can be used to localize the effects of positive
tabindexattributes, and the CSS property
orderis being petitioned to affect navigation order. Both approaches come with restrictions and side-effects. It might help thinking of the author’s need more along the lines of how the radio button works. Specifically the grouping mechanism. Along this line of thinking, the element
<input … tabindex="3" tabgroup="gustav">would still be taken out of the dom-orderd document’s navigation sequence, but not sorted to the beginning of the navigation sequence like now. Instead, the new (inert) element
<tabgroup name="gustav">would be replaced with the captured taborder sequence, in dom order of its occurrence.
I consider 1-3 easy requests and 4 a simple enough request. 5 is an idea I’ve been toying with and wanted to get some feedback on.