In my app's tab loop, the <html>
tag occupies a tab stop. I'm looking to remove the <html>
tag from the tap loop.
I tried adding tabindex="-1"
to the <html>
tag, but on IE11 at least, that did not seem to remove the element from the tab loop. I'm close to spinning my own logic using JS to "skip" to the next focusable element if document.activeElement === <html>
, but I'm wondering if there's an easier way.
The solution needs to be supported cross the major browsers: IE11, Edge, FF, Chrome, Safari.
Any ideas?
Use the tabindex attribute in HTML to set the tab order of an element. It gives you the authority to change the order of your TAB usage on the keyboard.
The way to do this is by adding tabindex="-1" . By adding this to a specific element, it becomes unreachable by the keyboard navigation.
Change the tab order for controls Use the following procedure to change the tab order of the controls. In the Navigation Pane, right-click the form and then click Design View. On the Design tab, in the Tools group, click Tab Order. In the Tab Order dialog box, under Section, click the section you want to change.
The only way to change this order is to reorder your HTML elements. tabindex itself can do 2 things: it sets the order of "focusable" elements. it makes element "focusable".
I visited HTML specification for tabindex attribute -> https://html.spec.whatwg.org/#the-tabindex-attribute
Below is the second para:
As it is clearly mentioned that the only way to make any element not focusable is by making it disable or make it invisible from DOM.
I am still searching and will post an update on this.
Moreover, I also tried to replicate this issue and could not do it on IE.(did not try to replicate on other browser).
I found the difference in tabIndex between HTML4 AND HTML5:
It is stated that though HTML5 allows adding tabIndex attributes on any element, it may not have any effect. This is applicable to HTML element also. My I know, how do we know if an HTML element is focused?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With