1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-30 19:03:04 +00:00

fix: check for input focus before looking at keyboard shortcuts (#5381)

Fixes #5326.

Notes: Turned off keyboard shortcuts when input fields have focus.
This commit is contained in:
Charles Kerr 2023-04-12 20:09:01 -05:00 committed by GitHub
parent 649be3b772
commit c3038d8ed7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -471,12 +471,15 @@ export class Transmission extends EventTarget {
const { ctrlKey, keyCode, metaKey, shiftKey, target } = event_; const { ctrlKey, keyCode, metaKey, shiftKey, target } = event_;
// look for a shortcut // look for a shortcut
const aria_keys = Transmission._createKeyShortcutFromKeyboardEvent(event_); const is_input_focused = target.matches('input');
const action = this.action_manager.getActionForShortcut(aria_keys); if (!is_input_focused) {
if (action) { const shortcut = Transmission._createKeyShortcutFromKeyboardEvent(event_);
event_.preventDefault(); const action = this.action_manager.getActionForShortcut(shortcut);
this.action_manager.click(action); if (action) {
return; event_.preventDefault();
this.action_manager.click(action);
return;
}
} }
const esc_key = keyCode === 27; // esc key pressed const esc_key = keyCode === 27; // esc key pressed
@ -487,7 +490,6 @@ export class Transmission extends EventTarget {
} }
const any_popup_active = document.querySelector('.popup:not(.hidden)'); const any_popup_active = document.querySelector('.popup:not(.hidden)');
const is_input_focused = target.matches('input');
const rows = this._rows; const rows = this._rows;
// Some shortcuts can only be used if the following conditions are met: // Some shortcuts can only be used if the following conditions are met: