]> BookStack Code Mirror - bookstack/commitdiff
Prevent search focus change on left/right arrow press
authorDan Brown <redacted>
Fri, 16 Dec 2022 17:03:48 +0000 (17:03 +0000)
committerDan Brown <redacted>
Fri, 16 Dec 2022 17:03:48 +0000 (17:03 +0000)
For #3920

resources/js/services/keyboard-navigation.js

index 9e05ef52893718f34d6984d5cec447ee5b171b35..0e1dcf1a756cf6ec5cd39d41c355265e6bbd7cce 100644 (file)
@@ -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();