浏览代码

fix(keyboard-shortcuts): process Unidentified keys (#2813)

* fix(keyboard-shortcuts): process Unidentified keys

When processing keyboard events for keyboard shortcuts,
if the value of an event's "key" attribute is "Unidentified",
the event should be further processed instead of the "key"
being returned to be mapped to a registered keyboard shortcut.
This occurs on edge, where question mark has the key
"Unidentified" but has the proper keyCode of 191.

* squash: add comment
master
virtuacoplenny 7 年前
父节点
当前提交
5b7b373e21
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6
    1
      modules/keyboardshortcut/keyboardshortcut.js

+ 6
- 1
modules/keyboardshortcut/keyboardshortcut.js 查看文件

@@ -144,7 +144,12 @@ const KeyboardShortcut = {
144 144
      * @returns {string} e.key or something close if not supported
145 145
      */
146 146
     _getKeyboardKey(e) {
147
-        if (typeof e.key === 'string') {
147
+        // If e.key is a string, then it is assumed it already plainly states
148
+        // the key pressed. This may not be true in all cases, such as with Edge
149
+        // and "?", when the browser cannot properly map a key press event to a
150
+        // keyboard key. To be safe, when a key is "Unidentified" it must be
151
+        // further analyzed by jitsi to a key using e.which.
152
+        if (typeof e.key === 'string' && e.key !== 'Unidentified') {
148 153
             return e.key;
149 154
         }
150 155
         if (e.type === 'keypress'

正在加载...
取消
保存