tabindex 0, -1, and Never Positive
Control what is focusable and what is only scriptable.
What tabindex Controls
The tabindex attribute decides whether an element can receive keyboard focus and how it fits into the Tab order. It is your dial for focusability.
Most Things Are Already Focusable
Links, buttons, and inputs are focusable by default, so you rarely touch tabindex on them. Reach for it only when the native element cannot do the job.
All lessons in this course
- tabindex 0, -1, and Never Positive
- Moving Focus After an Action
- Returning Focus When a Layer Closes
- Managing roving tabindex in Widgets