summaryrefslogtreecommitdiffstats
path: root/assets/js/handlers.js
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2022-02-09 01:42:11 +0100
committerGitHub <noreply@github.com>2022-02-09 01:42:11 +0100
commite2fc64296dacf6ce8a406183c1bb6388dce6d117 (patch)
treea4c492285c93809c5a3bce0b2052c27b8a98aaa3 /assets/js/handlers.js
parent170e75499816af460d76d05ce4d440d37a01e0fb (diff)
parentec55b905cb8b0b65deeb21a89751b17160676159 (diff)
downloadinvidious-e2fc64296dacf6ce8a406183c1bb6388dce6d117.tar.gz
invidious-e2fc64296dacf6ce8a406183c1bb6388dce6d117.tar.bz2
invidious-e2fc64296dacf6ce8a406183c1bb6388dce6d117.zip
Merge pull request #2874 from SamantazFox/small-fixes
Small fixes
Diffstat (limited to 'assets/js/handlers.js')
-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 == "/") {