-
Notifications
You must be signed in to change notification settings - Fork 131
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
Add keyboard shortcuts to the GUI #210
Add keyboard shortcuts to the GUI #210
Conversation
The shortcuts work great but I will say that not having j and k (or up and down) sort of defeats the purpose of having them imo. |
@SamL98 do you mean hotkeys to navigate around, selecting different resources? I sort of agree, because with that the GUI is nearly fully usable with hotkeys so the feature is "complete". But @rbs-jacob has said this is more just adding the infrastructure for hotkeys themselves, I think adding navigation will require a bit more code besides just adding a button. I think we could do without navigation, at least initially. |
I'll add j and k, and then this will be ready to merge. |
@rbs-jacob this looks cool! Would be nice to have a key bindings page in the docs, no? |
One sentence summary of this PR (This should go in the CHANGELOG!)
Add keyboard shortcuts to the GUI.
Please describe the changes in your request.
This PR adds support for keyboard shortcuts to the GUI. There is an (importable) global object for storing the shortcut keybindings and their callbacks. Any time a key is pressed outside of an input or
contentEditable
element, that object is searched and the respective callback is called.All of the toolbar buttons with associated shortcuts show their respective shortcut in a tooltip that appears when the button is hovered.
Any component can import and update the shortcuts object. Thus callbacks can close over reactive variables local to the component.
This design has a few nice properties:
For this first pass, I set a couple of shortcuts that can always be overridden later:
Anyone you think should look at this, specifically?
@whyitfor @EdwardLarson