event.key value is "Unidentified" for Escape, NumLock, and for all numpad keys (other than Enter) when numlock is on; event.code is empty string for all keys
JohnKlenk opened this issue · 0 comments
JohnKlenk commented
The event.key
value is "Unidentified" for Escape and NumLock, and for numpad keys other than Enter when numlock is on.
And for apparently every key, event.code
is an empty string.
Sample code:
<body>
<h1>Press a key</h1>
<div id="output"></div>
<script>
document.addEventListener('keydown', function(event) {
document.getElementById('output').innerHTML = `
key: ${event.key}<br>
code: ${event.code}<br>
which: ${event.which}<br>
keyCode: ${event.keyCode}<br>
`;
});
</script>
</body>
</html>