elementIsFocused
Checks if the given element is focused.
- Use
Document.activeElementto determine if the given element is focused.
const elementIsFocused = el => (el === document.activeElement);elementIsFocused(el); // true if the element is focused