From a89e04192fbeb1e2934b909f0a6c692dccf3ab77 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Tue, 17 Mar 2020 14:57:49 +0200 Subject: [PATCH] KeyboardNavigation prevented when text input focused --- .../KeyboardNavigation/KeyboardNavigation.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/services/KeyboardNavigation/KeyboardNavigation.js b/src/services/KeyboardNavigation/KeyboardNavigation.js index 80fd7cc31..4daa5095f 100644 --- a/src/services/KeyboardNavigation/KeyboardNavigation.js +++ b/src/services/KeyboardNavigation/KeyboardNavigation.js @@ -2,11 +2,15 @@ function KeyboardNavigation() { let active = false; function onKeyDown(event) { - if (event.keyboardNavigationPrevented) { + if (event.keyboardNavigationPrevented || event.target.tagName === 'INPUT') { return; } switch (event.code) { + case 'Digit0': { + window.location = '#/search'; + break; + } case 'Digit1': { window.location = '#/'; break; @@ -28,12 +32,10 @@ function KeyboardNavigation() { break; } case 'Backspace': { - if (event.target.tagName !== 'INPUT') { - if (event.ctrlKey) { - window.history.forward(); - } else { - window.history.back(); - } + if (event.ctrlKey) { + window.history.forward(); + } else { + window.history.back(); } break;