Skip to content

Instantly share code, notes, and snippets.

@bfred-it bfred-it/header.js forked from dominikwilkowski/header.js
Last active May 21, 2016

Embed
What would you like to do?
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();
}
}
@bfred-it

This comment has been minimized.

Copy link
Owner Author

commented Nov 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.