瀏覽代碼

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
      * @returns {string} e.key or something close if not supported
144
      * @returns {string} e.key or something close if not supported
145
      */
145
      */
146
     _getKeyboardKey(e) {
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
             return e.key;
153
             return e.key;
149
         }
154
         }
150
         if (e.type === 'keypress'
155
         if (e.type === 'keypress'

Loading…
取消
儲存