hasFocus

Gets a value indicating whether the object currently has focus.

MDN Reference