aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-14 19:08:05 -0500
committerGitHub <noreply@github.com>2021-01-14 19:08:05 -0500
commitc1e4741f22a017501f921ecc111b68fae35d0209 (patch)
tree3bc414b6b654b506fd8496d54162545f092576f8 /ext/bg
parent33aeae411065576dc7750ea01d8cdcd9959ee38d (diff)
Use code instead of key (#1234)
* Update KeyboardMouseInputField to use .code instead of .key * Update Display to use .code instead of .key * Remove unused function
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/settings/keyboard-mouse-input-field.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/ext/bg/js/settings/keyboard-mouse-input-field.js b/ext/bg/js/settings/keyboard-mouse-input-field.js
index 448841f6..5e7a2f2e 100644
--- a/ext/bg/js/settings/keyboard-mouse-input-field.js
+++ b/ext/bg/js/settings/keyboard-mouse-input-field.js
@@ -156,7 +156,7 @@ class KeyboardMouseInputField extends EventDispatcher {
// This is a hack and only works when both Shift and Alt are not pressed.
if (
!modifiers.has('meta') &&
- DocumentUtil.getKeyFromEvent(e) === 'Meta' &&
+ e.key === 'Meta' &&
!(
modifiers.size === 2 &&
modifiers.has('shift') &&
@@ -170,10 +170,16 @@ class KeyboardMouseInputField extends EventDispatcher {
_isModifierKey(keyName) {
switch (keyName) {
- case 'Alt':
- case 'Control':
- case 'Meta':
- case 'Shift':
+ case 'AltLeft':
+ case 'AltRight':
+ case 'ControlLeft':
+ case 'ControlRight':
+ case 'MetaLeft':
+ case 'MetaRight':
+ case 'ShiftLeft':
+ case 'ShiftRight':
+ case 'OSLeft':
+ case 'OSRight':
return true;
default:
return false;
@@ -183,7 +189,8 @@ class KeyboardMouseInputField extends EventDispatcher {
_onModifierKeyDown(e) {
e.preventDefault();
- const key = DocumentUtil.getKeyFromEvent(e);
+ let key = e.code;
+ if (key === 'Unidentified' || key === '') { key = void 0; }
if (this._keySupported) {
this._updateModifiers([...this._getModifierKeys(e)], this._isModifierKey(key) ? void 0 : key);
} else {