Negative Tab Indexing
Using a tabindex of -1 is (in my books) a fairly old trick to try and drop elements out of an existing tabindex order. But I suspect it’s a trick may have outlived its usefulness and may behave inconsistently across different user agents.What are your thoughts/experiences? Do we have more consistent best practice techniques that we can use instead?
Andrew Ozz 9:30 pm on July 26, 2012 Permalink |
Yes, tabindex=”-1″ has been around for quite a while and is a bit inconsistent between the browsers. The good thing about it is that this is the only way to make a link or a form element “skip” when tabbing. Another good thing is that it makes any HTML element “focusable” from JS, so <div id=”can-focus” tabindex=”-1″> will not be in the tabbing order and can be focused with
document.getElementById('can-focus').focus(). Both of these are consistent for all browsers.sprungmarker 8:26 pm on July 30, 2012 Permalink |
Tabindex was not used for quite a while because if using it you have to use it consistently for the whole site. It was a real burden to get that maintained. tabindex -1 and 0 is now in use to get javascript working properly for keyboard use i.e. I am only use tabindex for the latter.