diff options
author | Pierre Ossman <ossman@cendio.se> | 2019-11-01 09:59:02 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2019-11-01 09:59:02 +0100 |
commit | 5736ea0bd50db477ac501ffc016b0b4ca3268543 (patch) | |
tree | 2db5c485abd09c7575dc25cdffd8ee33b9568cab /core/input | |
parent | 94a01b0ae0b735c2da794e7870bf972a68fece69 (diff) | |
download | novnc-5736ea0bd50db477ac501ffc016b0b4ca3268543.tar.gz |
Fix AltGr for a few more keys in IE and Edge
Some keys apparently send 'Unidentified' rather than an unshifted value.
Make sure those are also handled. Examples are \ and | on a Swedish
keyboard.
Diffstat (limited to 'core/input')
-rw-r--r-- | core/input/util.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/core/input/util.js b/core/input/util.js index b0e8855..d93aafa 100644 --- a/core/input/util.js +++ b/core/input/util.js @@ -108,9 +108,16 @@ export function getKey(evt) { return 'Delete'; } - // IE and Edge have broken handling of AltGraph so we cannot - // trust them for printable characters - if ((evt.key.length !== 1) || (!browser.isIE() && !browser.isEdge())) { + // IE and Edge need special handling, but for everyone else we + // can trust the value provided + if (!browser.isIE() && !browser.isEdge()) { + return evt.key; + } + + // IE and Edge have broken handling of AltGraph so we can only + // trust them for non-printable characters (and unfortunately + // they also specify 'Unidentified' for some problem keys) + if ((evt.key.length !== 1) && (evt.key !== 'Unidentified')) { return evt.key; } } |