-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
keydownhandling 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
keypressevent, by usingevent.keywhen 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
keydownhandlers for keys we want to handle, whereevent.keyCodedisagrees with what we get from akeypressevent (eg. a page handlesa, but we handle an internationalised key that represents asaduringkeydown) - we move to a single key handler, since our
keypresshandlers 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.keyconsiderations only)
Metadata
Metadata
Assignees
Labels
No labels