As question really. I have an input box on my page that I would like to ignore when navigating using the keyboard tab key.
I'm using this input box as a simple bot honeytrap and positioning it off the page, so at the moment when using the tab key, it looks to the user as though nothing has focus when they tab to this element.
You can use
tabindex
attribute to define order in which the tab key should cycle through elements. If you settabindex="-1"
the element will be skipped.More info is available here http://www.webcheatsheet.com/HTML/controll_tab_order.php for example.
UPDATE changed tabindex="0" to "-1" based on comments
I used workaround
disabled
flag on my input element, because no user input is wanted in my case :)Example with 3 inputs:
Hope it works well for somebody <3 - Chrome, Edge, Firefox and also "pseudo" browser IE tested.
You can set the
tabindex="-1"
on this element so it's ignored in the tad order.0
tells the browser to figure out the tab order on it's own,-1
tells the browser to ignore it.display: none
it instead.