X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/559e392f1bdf02aa5f989c49c111cb0c2920a2fd..refs/pull/4317/head:/resources/js/services/keyboard-navigation.js diff --git a/resources/js/services/keyboard-navigation.js b/resources/js/services/keyboard-navigation.js index 0e1dcf1a7..34111bb2d 100644 --- a/resources/js/services/keyboard-navigation.js +++ b/resources/js/services/keyboard-navigation.js @@ -57,7 +57,6 @@ 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; @@ -72,7 +71,7 @@ export class KeyboardNavigationHandler { } else if (event.key === 'Escape') { if (this.onEscape) { this.onEscape(event); - } else if (document.activeElement) { + } else if (document.activeElement) { document.activeElement.blur(); } } else if (event.key === 'Enter' && this.onEnter) { @@ -86,10 +85,11 @@ export class KeyboardNavigationHandler { */ #getFocusable() { const focusable = []; - const selector = '[tabindex]:not([tabindex="-1"]),[href],button:not([tabindex="-1"]),input:not([type=hidden])'; + const selector = '[tabindex]:not([tabindex="-1"]),[href],button:not([tabindex="-1"],[disabled]),input:not([type=hidden])'; for (const container of this.containers) { - focusable.push(...container.querySelectorAll(selector)) + focusable.push(...container.querySelectorAll(selector)); } return focusable; } -} \ No newline at end of file + +}