diff --git a/src/assets/javascripts/integrations/keyboard/index.ts b/src/assets/javascripts/integrations/keyboard/index.ts index 0cb6e91e3..3c2cea1fb 100644 --- a/src/assets/javascripts/integrations/keyboard/index.ts +++ b/src/assets/javascripts/integrations/keyboard/index.ts @@ -92,6 +92,14 @@ export function setupKeyboard(): Observable { mode: getToggle("search") ? "search" : "global", ...key })), + filter(({ mode }) => { + if (mode === "global") { + const active = getActiveElement() + if (typeof active !== "undefined") + return !isSusceptibleToKeyboard(active) + } + return true + }), share() ) @@ -150,14 +158,7 @@ export function setupKeyboard(): Observable { /* Setup global keyboard handlers */ keyboard$ .pipe( - filter(({ mode }) => { - if (mode === "global") { - const active = getActiveElement() - if (typeof active !== "undefined") - return !isSusceptibleToKeyboard(active) - } - return false - }), + filter(({ mode }) => mode === "global"), withLatestFrom(useComponent("search-query")) ) .subscribe(([key, query]) => {