I am getting tabIndex property using javascript, for this element
<div role="radio" aria-checked="false" tabindex="-1">
<div id="if_empty" tabindex="-1" type="radio" value="Show only if empty"></div>
<label id="radioId" for="if_empty">Show only if empty</label>
</div>
It works perfectly in all browsers, except Internet Explorer.
const element = document.getElementById("radioId");
const tabIndex = element.tabIndex;
// tabIndex is -1 for Firefox/Chrome
// and it is equal 0 for Internet Explorer
How do I get the correct tabIndex in Internet Explorer?
The solution that worked for me was getting tabIndex with getAttribute('tabIndex')
for (let i = 0; i < rootNode.childNodes.length; i++) {
const child = rootNode.childNodes[i];
if (child.nodeType === 1 && child.getAttribute('tabIndex') === 0) {
//find tabbable element
}
}
Let me know if you don't like the question I will just remove it..