Forked from davidgilbertson/user-tabbing-class.js
Last active
November 7, 2017 11:29
-
-
Save LucaRosaldi/150d765c479ecb8a88b167db15bbf464 to your computer and use it in GitHub Desktop.
JS-CSS: Remove Outline on Focus (accessible)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html:not(.no-js):not(.user-is-tabbing) button:focus, | |
html:not(.no-js):not(.user-is-tabbing) input:focus, | |
html:not(.no-js):not(.user-is-tabbing) select:focus, | |
html:not(.no-js):not(.user-is-tabbing) textarea:focus { | |
outline: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var addUserTabbingClass = function( event ) { | |
if ( event.keyCode === 9 ) { // tab key | |
document.documentElement.classList.add( 'user-is-tabbing' ); | |
window.removeEventListener( 'keydown', addUserTabbingClass ); | |
} | |
} | |
window.addEventListener( 'keydown', addUserTabbingClass ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment