Last active
February 5, 2021 13:27
-
-
Save stephband/115b0307940989c79c9306ca49f95d4b to your computer and use it in GitHub Desktop.
Log activeElement on focus
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.addEventListener('focusin', (e) => | |
| // Sanity check for target being activeElement, should always be true | |
| console.log('focusin', e.target === document.activeElement, document.activeElement) | |
| ); | |
| document.addEventListener('focusout', (e) => | |
| // Sanity check that activeElement is body, should always be true | |
| console.log('focusout', document.body === document.activeElement) | |
| ); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, on Chrome too.