Web Accessibility & WCAG (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is `tabindex` and how do `0`, `-1`, and positive values differ?
junior LevelMost AskedaccessibilityBasic
In Simple Words:
tabindex="0": Inserts an element into the natural keyboard tab order based on its position in the DOM. Use to make custom components (e.g. custom slider) keyboard focusable.tabindex="-1": Makes an element programmatically focusable via JavaScript (element.focus()), but removes it from natural Tab navigation. Essential for moving focus to error containers or modal titles!- Positive
tabindex="1+"(CRITICAL ANTI-PATTERN): Forces the element to the front of the tab order before everything else, disrupting natural document flow. Never use positive tabindex!