Performance: Keyboard navigation support
This affects how quickly users can interact with page elements using the keyboard, impacting input responsiveness and user experience.
<button>Click me</button> <div tabindex="0">Focusable and keyboard navigable</div>
<button disabled>Click me</button> <div tabindex="-1">Focusable but not keyboard navigable</div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Disabled elements or tabindex="-1" | Low | 0 | Low | [X] Bad |
| Sequential tabindex="0" elements | Low | 1 per focus | Low | [OK] Good |
| Heavy JS focus management | Low | Multiple per key event | Medium | [X] Bad |
| Native focus with minimal JS | Low | 1 per focus | Low | [OK] Good |
tabindex attribute allows elements to receive keyboard focus and be reachable by Tab key.tabindex to enable keyboard navigation on custom interactive elements.<button class="btn btn-primary">Click Me</button>
tabindex="0" or a native focusable element.tabindex="0" makes the card reachable by keyboard Tab key.role="button" tells assistive tech the card is interactive, and aria-label describes it.Pass the test and this pattern moves unknown