Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Created March 5, 2013 21:49
Show Gist options
  • Save thefuxia/5094625 to your computer and use it in GitHub Desktop.
Save thefuxia/5094625 to your computer and use it in GitHub Desktop.
Userscript: Remove tabindex attributes Tested in Opera only.
// ==UserScript==
// @name Remove tabindex attributes
// @namespace remove-tabindex-toscho
// @description Removes all tabindex attributes
// @author Thomas Scholz
// ==/UserScript==
if ( tabFucked = document.querySelectorAll( "[tabindex]" ) ) {
for ( var i = 0, max = tabFucked.length; i < max; i++ ) {
if ( 0 != tabFucked[i].getAttribute( "tabindex" ) )
tabFucked[i].removeAttribute( "tabindex" );
}
}
@patrickhlauke
Copy link

as i originally suggested, though, i'd only remove tabindex > 0. otherwise, this kills cases like tabindex=0 (making not-normally-focusable elements focusable) and tabindex=-1 (allowing for JS focus to be set but not keyboard focusable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment