Closed
Description
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 from event
to the key we want to handle.
Pros:
- duplicated/similar code is moved to a library function.
- we will have to make anomalies in
keydown
handling explicit, which will help with debugging - when (or before) Chromium issue 227231 is resolved, we have a centralised place to implement on the new feature. From this point, we can stop relying on the depreciated
keypress
event, by usingevent.key
when it's available:- this will solve all keyboard internationalisation issues immediately (passing keys we are going to handle, and blocking the events for those we aren't)
- we can't be pre-empted by
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
) - we move to a single key handler, since our
keypress
handlers will never get events for any key we handle
- friendlier key-handling code
Cons:
- code movement/refactoring
- bugs from missed edge cases due to platfrom inconsistency
- no visible benefit for the user
- the Chromium issue will change this but will also require extra work
- redundancy in the code until old Chrome versions are abandoned (for
event.key
considerations only)
Metadata
Metadata
Assignees
Labels
No labels