Document.activeElement
to determine if the given element is focused.const elementIsFocused = el => (el === document.activeElement);
elementIsFocused(el); // true if the element is focused
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️