Created
July 26, 2018 09:11
-
-
Save andreasvirkus/fd21a818a5210023efc3c2f457a0776c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export default () => { | |
const styleEl = document.createElement('style') | |
document.head.appendChild(styleEl) | |
// Inject outline preventing styles only for non-keyboard users | |
document.addEventListener('mousedown', function () { | |
styleEl.innerHTML = 'a,a:focus,button,button:focus,input,input:focus,textarea,textarea:focus,div:focus {outline:none}' | |
}) | |
document.addEventListener('keydown', function () { | |
styleEl.innerHTML = '' | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment