summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2022-02-08 00:04:02 +0100
committerSamantaz Fox <coding@samantaz.fr>2022-02-08 01:26:51 +0100
commitb344e1aadbe301c343e8c186d34320729988a039 (patch)
tree8f50b296480c8cf331edb3ad0f4d32957ac1ccdd /assets
parent3c882cff6e31d8dfc680ce3fe4dce73ba8946817 (diff)
downloadinvidious-b344e1aadbe301c343e8c186d34320729988a039.tar.gz
invidious-b344e1aadbe301c343e8c186d34320729988a039.tar.bz2
invidious-b344e1aadbe301c343e8c186d34320729988a039.zip
handlers.js: fix TypeError on document.activeElement.type
Diffstat (limited to 'assets')
-rw-r--r--assets/js/handlers.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/assets/js/handlers.js b/assets/js/handlers.js
index d3957b89..02175957 100644
--- a/assets/js/handlers.js
+++ b/assets/js/handlers.js
@@ -150,13 +150,13 @@
// Ignore shortcuts if any text input is focused
let focused_tag = document.activeElement.tagName.toLowerCase();
- let focused_type = document.activeElement.type.toLowerCase();
- let allowed = /^(button|checkbox|file|radio|submit)$/;
+ const allowed = /^(button|checkbox|file|radio|submit)$/;
- if (focused_tag === "textarea" ||
- (focused_tag === "input" && !focused_type.match(allowed))
- )
- return;
+ if (focused_tag === "textarea") return;
+ if (focused_tag === "input") {
+ let focused_type = document.activeElement.type.toLowerCase();
+ if (!focused_type.match(allowed)) return;
+ }
// Focus search bar on '/'
if (event.key == "/") {