Only consider text input focus as active

This resolves comment on #116

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2022-12-30 16:17:29 -03:00
parent 84d30bbd7b
commit 4ebdd9ffa6
No known key found for this signature in database
GPG key ID: 53D76502731B4A7C

View file

@ -140,10 +140,13 @@ class DOM {
* @returns Whether there is currently an active input * @returns Whether there is currently an active input
*/ */
static hasActiveInput() { static hasActiveInput() {
return ( const active = document.activeElement;
document.activeElement && const tag = active.tagName.toLowerCase();
this.inputTags.has(document.activeElement.tagName.toLowerCase())
); const checkTag = this.inputTags.has(tag);
if (!checkTag) return false;
return tag !== "input" || active.type === "text";
} }
} }