Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #504

Open
JohnKlenk opened this issue Apr 11, 2024 · 0 comments

Comments

@JohnKlenk
Copy link

JohnKlenk commented Apr 11, 2024

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>
@JohnKlenk JohnKlenk changed the title Incorrect event.key values for Escape, NumLock, and some numpad keys; event.code is empty string for all keys 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 Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant