Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
-
Ubuntu 18.04.3 LTS
Firefox 70.0b2 and Chrome 77.0.3865.90
Description
The problem is that on Linux in case of such key-combo we receive "GroupNext" key instaead of "Shift".
In Firefox the keydown event looks like this:
keydown Alt-Control altKey: true bubbles: true cancelBubble: false cancelable: true charCode: 0 code: "ShiftLeft" composed: true ctrlKey: true currentTarget: null defaultPrevented: false detail: 0 eventPhase: 0 explicitOriginalTarget: <body> isComposing: false isTrusted: true key: "GroupNext" keyCode: 16 layerX: 0 layerY: 0 location: 0 metaKey: false originalTarget: <body> rangeOffset: 0 rangeParent: null repeat: false returnValue: true shiftKey: false srcElement: <body> target: <body> timeStamp: 2320832 type: "keydown" view: Window about:blank which: 16 <get isTrusted()>: function isTrusted() <prototype>: KeyboardEventPrototype { getModifierState: getModifierState(), initKeyboardEvent: initKeyboardEvent(), initKeyEvent: initKeyEvent(), ... }
So I guess the most easy way to fix it could be to change the order here https://github.com/apache/guacamole-client/blob/9d485ffcf755e88cccf9a7aadc72911633277117/guacamole-common-js/src/main/webapp/modules/Keyboard.js#L249
in the same way as in KeyupEvent.
But unfortunately in Chrome we get keyCode == 0
KeyboardEvent {isTrusted: true, key: "GroupNext", code: "ShiftLeft", location: 1, ctrlKey: true, ...} altKey: true bubbles: true cancelBubble: false cancelable: true charCode: 0 code: "ShiftLeft" composed: true ctrlKey: true currentTarget: null defaultPrevented: false detail: 0 eventPhase: 0 isComposing: false isTrusted: true key: "GroupNext" keyCode: 0 location: 1 metaKey: false path: (4) [body.light-chip.inited, html, document, Window] repeat: false returnValue: true shiftKey: false sourceCapabilities: InputDeviceCapabilities {firesTouchEvents: false} srcElement: body.light-chip.inited target: body.light-chip.inited timeStamp: 9475.445000000036 type: "keydown" view: Window {parent: Window, postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, ...} which: 0 __proto__: KeyboardEvent
So it looks like the only way to guess the real Shift key is event.code.