mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Ignore "/" key handling if search box is focused
Fixes a side effect of https://github.com/iv-org/invidious/pull/2814 See: https://github.com/iv-org/invidious/issues/2791#issuecomment-1018264144
This commit is contained in:
parent
eba311baa9
commit
15c66e2b01
1 changed files with 11 additions and 1 deletions
|
@ -146,7 +146,17 @@
|
|||
// Handle keypresses
|
||||
window.addEventListener('keydown', (event) => {
|
||||
// Ignore modifier keys
|
||||
if (event.ctrlKey || event.metaKey) { return; }
|
||||
if (event.ctrlKey || event.metaKey) return;
|
||||
|
||||
// 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)$/;
|
||||
|
||||
if (focused_tag === "textarea" ||
|
||||
(focused_tag === "input" && !focused_type.match(allowed))
|
||||
)
|
||||
return;
|
||||
|
||||
// Focus search bar on '/'
|
||||
if (event.key == "/") {
|
||||
|
|
Loading…
Reference in a new issue