Rule: Avoid tabindex > 0

Rule ID Keyboard 4
Conformance Required
Definition Avoid tabindex values greater than 0.
Purpose
  • Keyboard support is required by people who cannot use the mouse and/or gestures to select the options and perform the actions made available to them by interactive elements.
  • Native HTML4 and HTML5 link and form control elements have default keyboard interactions that are built-in and standardized among browsers.
  • When authors create custom interactive elements they need to support the keyboard interaction patterns that users have come to expect, and part of this support is understanding how the tabindex attribute value in managing keyboard focus.
  • The ARIA Authoring Practices Guide identifies how to use tabindex to help manage keyboard focus for widget roles.
  • NOTE: Touch typists often prefer keyboard commands over mouse actions, especially for frequently performed operations, since they are much more efficient from a hand motion perspective.
Conformance Required
WCAG Success Criteria

Success Criterion 2.1.2 No Keyboard Trap

Rule Category Keyboard Support
Rule Scope Element
Techniques
  • Avoid using tabindex values greater than 0 to change tabbing order, since tab sequence for values greater than 0 is inconsistent and therefore can be unpredictable across web browsers.
  • HTML form controls and link elements do not need a tabindex valuable to be part of the sequential tab order, assigning a tabindex value to one of these elements means you intend to change their default behavior.
  • Setting tabindex attribute to 0 allows an element to become focusable and makes it part of the tab sequence of the page
  • Setting tabindex attribute to -1 allows an element to become focusable through related keyboard event handlers through scripting
  • Use the ARIA Authoring Practices to define keyboard support that is appropriate for widget roles.
  • Use keyboard event handlers to implement keyboard support for interactive behaviors defined on the page.
Information Links