So, I’ve got this situation here :
Why when I tab, it does not select Search then Submit? Isn’t that the point of Tabindex?
So, I’ve got this situation here :
Why when I tab, it does not select Search then Submit? Isn’t that the point of Tabindex?
First of all, input
is tab-able tag, so there should be no tabindex
to start with
My guess that you would like to start tab order from input
field, if true than try adding autofocus
attribute to the input
:
<input type="search" id="searchInputField" name="search" autofocus>
You should not use tabindex
with values greater than 0
, basically there are only 2 cases:
tabindex="-1"
=> Ignore tabbing of otherwise tab-able elementtabindex="0"
=> Make element tab-able in sequential orderThis was literally the point of the exercise given :
Camper Cat has a search field on his Inspirational Quotes page that he plans to position in the upper right corner with CSS. He wants the search
input
and submitinput
form controls to be the first two items in the tab order. Add atabindex
attribute set to “1” to the searchinput
, and atabindex
attribute set to “2” to the submitinput
.
Still, this was a helpful answer in a different way than expected
Is this freeCodeCamp challenge?
UPDATE: Yeah, I found it. So you now see that the way it described in challenge not quite works, just submit the answer to pass the tests and remember my remarks for future. Some challenges on freeCodeCamp (as well as Internet in general) are simply outdated and might no longer be actual - it’s normal.
Yeah, sorry, I should have linked the question!
Aren’t old formatting supposed to work in newer versions? Still, autofocus looks neat.