Created
November 14, 2022 18:48
-
-
Save lwkchan/784209132b693b2534ba3765c2400fbf to your computer and use it in GitHub Desktop.
Logs active element in console when using tab key to navigate
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
document.body.addEventListener('keydown', function(e) { | |
if (e.which === 9) { | |
setTimeout(function() { | |
console.log(document.activeElement); | |
}, 100); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment