diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-09-26 18:14:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-26 18:14:00 -0400 |
commit | c364714c8188ab1503b53b096a70b1fd5b6b3055 (patch) | |
tree | 5f3a2af8b3ec19dbe3dfc88514f2b87e1a4bfc60 /ext/js/pages | |
parent | d739ccd63f0554f0f880e7463355dd5c4ff166e4 (diff) |
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
Diffstat (limited to 'ext/js/pages')
-rw-r--r-- | ext/js/pages/settings/settings-display-controller.js | 15 |
1 files changed, 2 insertions, 13 deletions
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; } |