As per the title, what is the difference when I have tabIndex="false"
versus having empty tabIndex
? As a bonus, what's the difference with having tabIndex="false"
versus tabIndex=false
versus empty tabIndex
?
For example:
<a tabIndex="false" />
versus <a tabIndex />
versus <a tabIndex=false />
I haven't been able to find any resource or stackoverflow question that sheds light on this scenario.
Thanks in advance~
There is no difference.
As Xufox explains in a comment, tabindex
can only have integers as values. This is indicated in the HTML specification:
The tabindex attribute, if specified, must have a value that is a valid integer.
Having tabindex
(without a value), or tabindex="false"
or tabindex=false
is irrelevant as all of them will fail the rules for parsing integers (in steps 5, 7, and 7 respectively). In those cases, browsers will ignore the value and apply the logic that they apply by default to any element.
So all of the following would be treated equally:
<input tabindex="false" />
<input tabindex=false />
<input tabindex="" />
<input tabindex />
<input />