Handle language-switching keystroke gracefully
This commit is contained in:
parent
56631344ba
commit
187b90dd84
1 changed files with 5 additions and 1 deletions
|
|
@ -148,7 +148,11 @@ var Keys = (function() {
|
|||
oop.mixin(exports, Keys);
|
||||
|
||||
exports.keyCodeToString = function(keyCode) {
|
||||
return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase();
|
||||
// Language-switching keystroke in Chrome/Linux emits keyCode 0.
|
||||
var keyString = Keys[keyCode];
|
||||
if (typeof keyString != "string")
|
||||
keyString = String.fromCharCode(keyCode);
|
||||
return keyString.toLowerCase();
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue