Skip to content

Instantly share code, notes, and snippets.

@fregante
Forked from dominikwilkowski/00-README.md
Last active May 21, 2016 12:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fregante/ffb6a3fe8303f9330e95 to your computer and use it in GitHub Desktop.
Save fregante/ffb6a3fe8303f9330e95 to your computer and use it in GitHub Desktop.
Doc strange outline love (jQuery-free)
//detecting tab key press
document.body.addEventListener('keydown', function detector (e) {
var keyCode = e.keyCode || e.which;
if(keyCode == 9) {
console.log( 'Tab detected' );
document.documentElement.className += ' is-keyboarduser';
document.body.removeEventListener('keydown', detector);
}
});
.outline() {
outline: none;
.is-keyboarduser & {
outline: 2px dotted #000;
outline-offset: 0.5rem;
}
}
.tab-link {
&:focus {
.outline();
}
}
@fregante
Copy link
Author

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