Sfoglia il codice sorgente

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 anni fa
parent
commit
5b7b373e21
1 ha cambiato i file con 6 aggiunte e 1 eliminazioni
  1. 6
    1
      modules/keyboardshortcut/keyboardshortcut.js

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

@@ -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'

Loading…
Annulla
Salva