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

KeyboardEvent.key_code() returns ASCII keycode and not the js keycode #2197

Open
happysalada opened this issue Jun 11, 2020 · 0 comments
Open
Labels

Comments

@happysalada
Copy link

Describe the Bug

the web_sys::KeyboardEvent.key_code() returns the ASCII keycode and not the js keycode. Looking at the implementation directly, it seems to be a perfect mirror of the js implementation
see doc, so I'm not even sure how it's possible.

Steps to Reproduce

  1. Add a keypress callback on window with event.key_code().
  2. Press a (it will show 97, instead of 48)

I have an app using a framework that I don't mint sharing, but there is quite a bit more code in there, so I'm not sure sharing it helps

Expected Behavior

key_code should be the same as the js keyCode

Actual Behavior

key_code is the ASCII key_code

Additional Context

not really sure what would be helpful here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant