-
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
Allow hotkeys to have multiple alphanumeric keys pressed down at the same time #6938
base: develop
Are you sure you want to change the base?
Conversation
Generate changelog in
|
Add generated changelog entriesBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
Fix hotkey testsBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
Handle space unit testBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
Fix tester exampleBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
DiffBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
Add two multiple key combos on the piano exampleBuild artifact links for this commit: documentation | landing | table | demoThis is an automated comment from the deploy-preview CircleCI job. |
Checklist
Changes proposed in this pull request:
For my hackweek project, I wanted to implement throughout hotkeys in Apollo for power users. We copied a lot of the hotkeys commonly used in other apps, and one of the common page navigation hotkeys is "g + some character" to denote "Go to some page". For example, if I want to "Go to Dashboard", I would type "g + d".
However, useHotkeys in Blueprint currently does not support having multiple alphanumeric keys pressed down at the same time. This PR changes the key combo to hold a set of keys rather than a singular key and enables this functionality.
DOWNSIDE
The piano example for hotkeys becomes kind of broken with this PR. Now we need to manually encode the combinations of q + w, w + e, etc. Otherwise the example just breaks for multiple hotkey combinations. Currently I added hotkey combinations for q + w and w + e but it doesnt make sense to hardcode each of these because the number of ways to choose 1 - 10 keys out of 24 is 4,687,385.
If the decision is to just disallow pressing multiple keys within this example, I can remove the hotkey combinations for q + w and w + e that I added.
Testing
Added unit tests, can also test using the key-combo-tester
Screenshot