Skip to content

Instantly share code, notes, and snippets.

@norbert-codes
Created July 8, 2018 12:54
Show Gist options
  • Select an option

  • Save norbert-codes/6e2716c5bd3c268cf38f683a39cc24e0 to your computer and use it in GitHub Desktop.

Select an option

Save norbert-codes/6e2716c5bd3c268cf38f683a39cc24e0 to your computer and use it in GitHub Desktop.
Removing that ugly :focus ring (and keeping it too) from: https://hackernoon.com/removing-that-ugly-focus-ring-and-keeping-it-too-6c8727fefcd2
body:not(.user-is-tabbing) {
button:focus,
input:focus,
select:focus,
textarea:focus {
outline: none;
}
}
function handleFirstTab(e) {
if (e.keyCode === 9) {
document.body.classList.add('user-is-tabbing');
window.removeEventListener('keydown', handleFirstTab);
}
}
window.addEventListener('keydown', handleFirstTab);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment