THE GITHTML FIELD GUIDE
Remove positive tabindex from document navigation
Prefer a logical source order and native focusable elements instead of positive tabindex values that manually reorder navigation. Positive values can create a sequence that jumps around the visual page and becomes fragile as links are added. Use tabindex=0 or -1 only for a clear purpose, not as a general layout repair.
Understand the access barrier
A sidebar can be visually moved with CSS while retaining a different source position. Adding numbered tabindex values may appear to fix one path but creates a separate ordering system that future authors must maintain.
Use a deliberate document pattern
Reorder the markup to match the intended reading and interaction sequence where possible. Do not make every heading or paragraph a Tab stop; document reading and control navigation are different tasks. Preserve native links and buttons rather than recreating them with generic elements.
- Find positive tabindex values and identify the ordering problem they were intended to solve.
- Repair source order rather than assigning a new number to every interactive element.
- Keep static prose out of the routine Tab sequence unless there is a specific interaction need.
<a href="#overview">Overview</a>
<a href="#results">Results</a>Check the actual reading experience
Traverse forward and backward through the page and compare the sequence with its visible structure.
Avoid a second hidden ordering system
Imagine a two-column report with a sidebar placed visually on the right but appearing before the article in the source. Assigning tabindex=1 to article links and higher numbers to sidebar links can appear to repair the desktop route. On a narrow screen, however, the layout may stack differently, and newly inserted links without positive values can appear after the entire numbered sequence. The author now maintains two conflicting orders.
Positive tabindex values are traversed ahead of ordinary zero or naturally focusable elements, in their numerical ordering. This can pull a control from the middle of a document to the start of the keyboard journey. Fix the underlying source sequence where possible, then use layout techniques that preserve a logical relationship between visual and nonvisual reading. A layout should not require a spreadsheet of tabindex numbers to remain navigable after every edit.
Distinguish focus management from routine navigation. tabindex=0 can place an otherwise nonfocusable element in the normal sequence when it genuinely needs keyboard interaction; tabindex=-1 can support an intentional programmatic or fragment focus target without adding a standard Tab stop. Neither should be scattered through ordinary paragraphs to make a document supposedly accessible. Screen-reader reading commands already traverse static text through a different mechanism. Test forward and backward navigation at both wide and narrow layouts, including any disclosure controls and inline links. If a custom widget needs specialized focus behavior, follow its established interaction pattern rather than imposing that pattern on the entire reading page. The repair should reduce complexity while keeping every actual action reachable.
Sources and further reading
AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.