From: Dan Brown Date: Fri, 16 Dec 2022 17:03:48 +0000 (+0000) Subject: Prevent search focus change on left/right arrow press X-Git-Tag: v22.11.1~1^2~7 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/2c0a7346b1635b5fd1599a86e33e3c834d9a967c Prevent search focus change on left/right arrow press For #3920 --- diff --git a/resources/js/services/keyboard-navigation.js b/resources/js/services/keyboard-navigation.js index 9e05ef528..0e1dcf1a7 100644 --- a/resources/js/services/keyboard-navigation.js +++ b/resources/js/services/keyboard-navigation.js @@ -57,6 +57,12 @@ export class KeyboardNavigationHandler { * @param {KeyboardEvent} event */ #keydownHandler(event) { + + // Ignore certain key events in inputs to allow text editing. + if (event.target.matches('input') && (event.key === 'ArrowRight' || event.key === 'ArrowLeft')) { + return; + } + if (event.key === 'ArrowDown' || event.key === 'ArrowRight') { this.focusNext(); event.preventDefault();