-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[core] fix(HotkeyParser): use e.code to get physical keys #6301
Conversation
export const SHIFT_KEYS: KeyMap = { | ||
"~": "`", | ||
"!": "1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer need the 0-9 digit keys in this mapping because we now handle events with { code: "DigitX" }
in a more straightforward way. In a future PR, we can remove this KeyMap
entirely by switching to event.code
for more keys, but for now I decided to be conservative and make fewer behavioral changes in this PR.
Edit: I added a code comment to reflect this
[core] fix(HotkeyParser): use e.code to get physical keysBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
Fix self-review and lintBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
I think there's one more regression compared to v4.x which is worth fixing related to the "space" key. Currently with this PR: On v4.x legacy docs: |
use e.code for space keyBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
Fixes #6257
Checklist
Changes proposed in this pull request:
Refactor HotkeyParser functions to use
event.code
instead ofevent.key
in most cases. This property is more reliable thanevent.key
since the latter is prone to changing based on keyboard layout and modifier keys. This change restores the behavior of the hotkey parser (which is responsible for taking a user-requested key combo and generating the appropriate event handler) to that of Blueprint v4.x (it regressed in v5.0 via #6106).I also updated the docs to move the "Key combo" and "hotkeys tester" sections to the non-deprecated
useHotkeys
documentation (previously this was only available on the "Hotkeys (legacy)" docs page).Reviewers should focus on:
No regressions in
useHotkeys()
Screenshot
before this change:
after this change:
in Blueprint v4.x legacy docs: