-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Unify key decoding for keydown #1676
Comments
Switching to |
@lydell I can't seem to find the comment you're referring to, could you quote it here? To my understanding, |
Sorry I linked to the wrong PR. I've updated my comment above. |
My suggestion in the issue was about replacing
I understand the motivation (keyboard layout agnosticism), but that seems like a separate feature request. Since this is also much harder to get right, I think we should do it separately. For example:
For these (and other reasons), I would rather see that treated as a separate issue. |
At the moment, we decode keys seperately for each
keydown
handler. With a view to reducing bugs and handling international keyboard layouts correctly, I think we should centralise conversion fromevent
to the key we want to handle.Pros:
keydown
handling explicit, which will help with debuggingkeypress
event, by usingevent.key
when it's available:keydown
handlers for keys we want to handle, whereevent.keyCode
disagrees with what we get from akeypress
event (eg. a page handlesa
, but we handle an internationalised key that represents asa
duringkeydown
)keypress
handlers will never get events for any key we handleCons:
event.key
considerations only)The text was updated successfully, but these errors were encountered: