-
Notifications
You must be signed in to change notification settings - Fork 332
Add ctrl-p and ctrl-n for up/down navigation in drop-downs #2097
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
base: main
Are you sure you want to change the base?
Conversation
yagebu
left a comment
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.
Thanks for this PR. Since these are not totally obvious shortcuts (not everyone uses vim), I think we should document them. Could you either add a section to the index help page documenting them (there's already a sentence about shortcuts there) or create a new help page for keyboard shortcuts.
| } else if (event.key === "ArrowUp") { | ||
| } else if ( | ||
| event.key === "ArrowUp" || | ||
| (event.ctrlKey && event.key.toLowerCase() === "p") |
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.
| (event.ctrlKey && event.key.toLowerCase() === "p") | |
| (event.ctrlKey && event.key === "p") |
If they're hitting Ctrl+Shift+p, let's not trigger this. (e.g. in Firefox that's the shortcut to open a new private window). Same for the other one.
upsuper
left a comment
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.
My 2c.
I tend to think that this kind of non-obvious shortcuts are better done in a way that doesn't affect other users by default. Each person has their preference on keyboard usage, and unintuitive shortcuts definitely don't help on that. As an example, I removed ctrl-c shortcut for toggling charts in #1603 which was very annoying for me.
Some potential solutions including:
- Don't do it at all here. It should be fairly easy to implement such shortcuts with a browser user script that captures the keyboard event, and maybe dispatches a synthetic event with arrow key if needed. It would affect just yourself, and doesn't introduce any complexity to the project.
- Add an option that enables different key scheme. More shortcuts may be added under those key schemes to allow user opt-in something they want to use. One such scheme could be Vim scheme.
- Add some hook point that allows a plugin to provide shortcuts. Beancount and Fava have been moderately extensible. It might be useful to make it more so with more hook points provided.
I think it makes more sense to start with the first. User scripts can also be shared outside this project, and if such script sees more widespread adoption, it may start making more sense to integrate with the project itself with other solutions above.
Hiya! I definitely agree that a bunch of custom shortcuts leading to a "shortcut soup" is no good. The reason I thought it was worth sharing this one is that I thought it's a pretty standard one (I might be biased?). |
I'd be very cautious using macOS as guidance on shortcuts. Majority of UI shortcuts on macOS use Command modifier key, but on other systems this role is taken by Ctrl instead. This difference makes using Ctrl shortcuts much less problematic on macOS than on other systems. Ctrl+P is widely used as the shortcut for Print, and Ctrl+N is widely used as creating new window on Windows and Linux distros. On macOS they are instead Command-P and Command-N so you don't see this problem there. Similarly, I often use Control-A on macOS to move the cursor to the beginning of line, but you need to be aware this is for Select All on all other systems. That says, it may make more sense if these shortcuts are restricted to macOS rather than applied universally given that's a convention of the system. |
Hi! I added ctrl+p and ctrl+n shortcuts to move the selection up & down in dropdown menus, e.g. in the slice editor auto-complete, or in the account quick-open. These are common shortcuts that I use everywhere else. I find it quite useful since they let me keep my hands on the home row (and avoid the horrible macbook arrow keys!).