Skip to content

Commit

Permalink
Add rule about tabindex > 0 to the styleguide (#12981)
Browse files Browse the repository at this point in the history
  • Loading branch information
timroes authored Jul 22, 2017
1 parent 7d08c68 commit 2043cf0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion style_guides/html_style_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,10 @@ If something is meant to be clickable, favor using a `button` or `a` tag before
### Use `tabindex` to make elements tabbable

When added to the tab order, elements become focusable via non-sticky-mode keyboard navigation.
To add an element to the tab order, you must add an `id` attribute as well as a `tabindex` attribute. If you don't know which number to use for the tab index, or if you simply want to add it to the general flow of the document, use `tabindex="0"`.
To add an element to the tab order, you must add an `id` attribute as well as a `tabindex` attribute.

You should only use `tabindex="0"` to add an element to the tab flow or `tabindex="-1"` to remove an
otherwise focusable element from the focus flow (use with care).
You should never use a value greater than 0, since tabindex is a global counter for the whole
webpage and not scoped to parent elements, so you would need to manage a globally meaningful order
across all elements in the whole source code.

0 comments on commit 2043cf0

Please sign in to comment.