From 4ebdd9ffa6c036a788269882891ed00e147afee9 Mon Sep 17 00:00:00 2001 From: Victor Seiji Hariki Date: Fri, 30 Dec 2022 16:17:29 -0300 Subject: [PATCH] Only consider text input focus as active This resolves comment on #116 Signed-off-by: Victor Seiji Hariki --- js/lib/util.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/lib/util.js b/js/lib/util.js index 22b3c1c..850b346 100644 --- a/js/lib/util.js +++ b/js/lib/util.js @@ -140,10 +140,13 @@ class DOM { * @returns Whether there is currently an active input */ static hasActiveInput() { - return ( - document.activeElement && - this.inputTags.has(document.activeElement.tagName.toLowerCase()) - ); + const active = document.activeElement; + const tag = active.tagName.toLowerCase(); + + const checkTag = this.inputTags.has(tag); + if (!checkTag) return false; + + return tag !== "input" || active.type === "text"; } }