[core] fix(HotkeyParser): use e.code to get physical keys #6301
+188
−144
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: