How to debug tabindex

Artic picture Artic · Aug 9, 2012 · Viewed 9.5k times · Source

Are there any tools or plugins for web browser to debug tabindex functionality? It seems that tabindex attributes are correct but it behaves not as expected. Or do I do something wrong?

Answer

Cristophs0n picture Cristophs0n · Jun 16, 2017

You can use the developer tools in Chrome, Firefox, and IE by pressing F12 and navigating to the console tab and then insert the following:

document.addEventListener('keyup', function() {console.log(document.activeElement)})

Now when you tab through the focusable items the activeElement including its tabindex, if you have one set, will be printed to the console.