Skip to content Skip to sidebar Skip to footer

Is Tabindex Hack For Css :focus Specified Somewhere?

There is a hack to make work :focus pseudoclass for div elements: adding to div tabindex. Like this: Is this behavior specified somewhere in W3C documents (where?) or is it just a

Solution 1:

tabindex is one of the global attributes. This means it can be specified on all HTML elements.

0 is a valid value (see "If the value is a zero" under the definition of tabindex).

So your HTML is fine.

Solution 2:

tabindex will work on the following elements in HTML5. https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute

  • a elements that have an href attribute
  • link elements that have an href attribute
  • button elements
  • input elements whose type attribute are not in the Hidden state
  • select elements
  • textarea elements

Post a Comment for "Is Tabindex Hack For Css :focus Specified Somewhere?"