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;
Assume that ele
represents the element that you want to check if it has the focus currently:
const hasFocus = ele === document.activeElement;