23/97

Detect if an element is focused

Assume that ele represents the element that you want to check if it has the focus currently:

const hasFocus = ele === document.activeElement;