Detailed answer
Zero places an appropriate element in normal sequential focus order.
Minus one permits programmatic focus without an ordinary Tab stop. Native interactive controls already participate in focus navigation. Positive values can conflict with visual and document order and are best avoided. Keep extra focus stops limited to meaningful interaction needs.
Example
<main id="main" tabindex="-1"><h1>Lesson</h1></main>
Understanding the behavior
Tabindex=0 joins the normal sequential focus order, while -1 generally permits programmatic focus without joining that sequence. Positive values create a separate ordering that can become confusing as a page changes. Native interactive elements often need no tabindex.
Practical implementation notes
Follow the page with Tab and Shift+Tab. The focus order should match a sensible reading order. Removing a control from the tab sequence does not automatically hide it from assistive technology.
How to check it
Use tabindex=-1 for the programmatic destination and inspect the natural Tab sequence.
Expected result
The heading can receive managed focus without cluttering sequential navigation.
Watch out: Do not add a Tab stop to every paragraph or decoration.
Read the reference ↗