summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsamhed <samuel@cendio.se>2014-04-14 13:26:52 +0200
committersamhed <samuel@cendio.se>2014-04-14 13:26:52 +0200
commit60a415ae1c338856b1e47ea3517067e6e8257c85 (patch)
treeede1e0b36fa7007aa7777bea18925848bb7ea267
parent8f4a291b1681c81dd6b5bc2d886a6d047c577998 (diff)
downloadnovnc-60a415ae1c338856b1e47ea3517067e6e8257c85.tar.gz
Credit for this fix goes to Jesper Dam (https://github.com/Medical-Insight/noVNC/tree/fix-ie10-keyboard).
Fix keyboard handling for IE10 (issue #352) * Keyboard events in IE10 do not provide any useful information on the properties 'which', 'char' or 'charCode'. Instead, it seems to store the char code in the keyCode property.
-rw-r--r--include/keyboard.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/keyboard.js b/include/keyboard.js
index 6bea9b5..c89411c 100644
--- a/include/keyboard.js
+++ b/include/keyboard.js
@@ -173,7 +173,10 @@ var kbdUtil = (function() {
else if (evt.charCode) {
codepoint = evt.charCode;
}
-
+ else if (evt.keyCode && evt.type === 'keypress') {
+ // IE10 stores the char code as keyCode, and has no other useful properties
+ codepoint = evt.keyCode;
+ }
if (codepoint) {
var res = keysyms.fromUnicode(substituteCodepoint(codepoint));
if (res) {