Browse Source

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 years ago
parent
commit
5b7b373e21
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      modules/keyboardshortcut/keyboardshortcut.js

+ 6
- 1
modules/keyboardshortcut/keyboardshortcut.js View File

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…
Cancel
Save