Created
February 5, 2024 20:12
-
-
Save erdum/b98007104391e6923827d525a330fc93 to your computer and use it in GitHub Desktop.
Check if a element or its child has current focus
This file contains 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
function hasFocus(element) { | |
return element.contains(document.activeElement); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment