w3c-keyname
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -84,2 +84,4 @@ var base = { | ||
const chrome = typeof navigator != "undefined" && /Chrome\//.test(navigator.userAgent) | ||
// Fill in the digit keys | ||
@@ -101,3 +103,7 @@ for (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i) | ||
function keyName(event) { | ||
return event.key || (event.shiftKey ? shift : base)[event.keyCode] || "Unidentified" | ||
// Don't trust event.key in Chrome when there are modifiers until | ||
// they fix https://bugs.chromium.org/p/chromium/issues/detail?id=633838 | ||
return ((!chrome || !event.ctrlKey && !event.altKey && !event.metaKey) && event.key) || | ||
(event.shiftKey ? shift : base)[event.keyCode] || | ||
event.key || "Unidentified" | ||
} | ||
@@ -104,0 +110,0 @@ |
{ | ||
"name": "w3c-keyname", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Get a KeyboardEvent.key-style string from an event", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4225
104