Tabindex

The tabindex attribute controls the order in which elements receive focus via the tab key, and it is essential for accessible interfaces because many people navigate by keyboard alone – relevant to WCAG success criterion 2.4.3 (Focus Order).

In practice

tabindex="0" makes an element that is not focusable by default – a span made interactive with JavaScript, for example – focusable in the natural document order. tabindex="-1" removes an element from the tab order but still allows programmatic focus, for instance when opening a modal or as the target of a skip link. Values greater than 0 should be avoided, because they destroy the natural, logical order. Whether everything works as intended is ultimately shown only by a real keyboard test.

Matching service

Sources

← Back to the glossary