Skip to content

Instantly share code, notes, and snippets.

@GitHubEmploy
Created January 14, 2022 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GitHubEmploy/0b73f597e7be1853ac702a980965642d to your computer and use it in GitHub Desktop.
Save GitHubEmploy/0b73f597e7be1853ac702a980965642d to your computer and use it in GitHub Desktop.
const elementIsInFocus = (el) => (el === document.activeElement);
elementIsInFocus(anyElement) // Result: If it is in focus, it will return True, otherwise it will return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment