The tabindex
attribute[1][2] controls an element’s focus behavior:
tabindex="0"
: The element is reachable via keyboard navigation, and its order is determined by the document’s source order.tabindex="-1"
: The element is not reachable by keyboard navigation but can be focused programmatically with JavaScript.
Positive values —like tabindex="1"
— are technically valid but strongly discouraged, as they often disrupt the logical navigation order.