From c364714c8188ab1503b53b096a70b1fd5b6b3055 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 26 Sep 2021 18:14:00 -0400 Subject: Fix hotkey input field conflict (#1963) * Move comment * Add DocumentUtil.isInputElement * Use DocumentUtil.isInputElement * Fix simple hotkeys (shift or no modifier) preventing text field input * Improve input detection * Validate key is an input character before blocking hotkey * Simplify * Fix incorrect property --- ext/js/pages/settings/settings-display-controller.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'ext/js/pages/settings') diff --git a/ext/js/pages/settings/settings-display-controller.js b/ext/js/pages/settings/settings-display-controller.js index 9d3e5459..7a40381b 100644 --- a/ext/js/pages/settings/settings-display-controller.js +++ b/ext/js/pages/settings/settings-display-controller.js @@ -16,6 +16,7 @@ */ /* global + * DocumentUtil * PopupMenu * SelectorObserver */ @@ -155,7 +156,7 @@ class SettingsDisplayController { _onKeyDown(e) { switch (e.code) { case 'Escape': - if (!this._isElementAnInput(document.activeElement)) { + if (!DocumentUtil.isInputElementFocused()) { this._closeTopMenuOrModal(); e.preventDefault(); } @@ -357,18 +358,6 @@ class SettingsDisplayController { } } - _isElementAnInput(element) { - const type = element !== null ? element.nodeName.toUpperCase() : null; - switch (type) { - case 'INPUT': - case 'TEXTAREA': - case 'SELECT': - return true; - default: - return false; - } - } - _setupDeferLoadIframe(element) { const parent = this._getMoreContainer(element); if (parent === null) { return; } -- cgit v1.2.3