You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for ⌃P (select up) and ⌃N (select down) in lists #7266
Thanks @erusev! I'm curious if there's a reason why arrow keys aren't sufficient for navigating through lists, or if it's personal preference based on muscle memory from other apps?
Sure, the main reason is that in order to use arrow keys you have to move your hand and this is significantly slower.
Also, since these alternative shortcuts are quite common across MacOS apps, they are muscle memory for people who use them and not having them available feels frustrating.
I started on a rough patch to see what it would take to get this working:
diff --git a/app/src/ui/lib/list/list.tsx b/app/src/ui/lib/list/list.tsx
index e8d6fe970..733fc5466 100644
--- a/app/src/ui/lib/list/list.tsx+++ b/app/src/ui/lib/list/list.tsx@@ -379,7 +379,16 @@ export class List extends React.Component<IListProps, IListState> {
return
}
- if (event.key === 'ArrowDown') {+ const { key, ctrlKey } = event++ // macOS also supports emacs-inspired shortcuts for moving up/down lists+ // see https://jblevins.org/log/kbd for more information+ const isArrowDown =+ key === 'ArrowDown' || (__DARWIN__ && ctrlKey && key === 'n')+ const isArrowUp =+ event.key === 'ArrowUp' || (__DARWIN__ && ctrlKey && key === 'p')++ if (isArrowDown) {
if (
event.shiftKey &&
this.props.selectionMode &&
@@ -390,7 +399,7 @@ export class List extends React.Component<IListProps, IListState> {
this.moveSelection('down', event)
}
event.preventDefault()
- } else if (event.key === 'ArrowUp') {+ } else if (isArrowUp) {
if (
event.shiftKey &&
this.props.selectionMode &&
There's a few other places in the codebase where we look for 'ArrowDown' or 'ArrowUp' events, but I think this is an interesting issue for a contributor with macOS who wants to improve these interactions to take a shot at this, so I'm going to mark this as help-wanted.
Hi all, I made a PR that implements @shiftkey's idea in the files where ArrowDown or ArrowUp are used. Let me know if there's any feedback or if there might be tests I need to update.
Activity
billygriffin commentedon Apr 12, 2019
Thanks @erusev! I'm curious if there's a reason why arrow keys aren't sufficient for navigating through lists, or if it's personal preference based on muscle memory from other apps?
erusev commentedon Apr 12, 2019
Sure, the main reason is that in order to use arrow keys you have to move your hand and this is significantly slower.
Also, since these alternative shortcuts are quite common across MacOS apps, they are muscle memory for people who use them and not having them available feels frustrating.
erusev commentedon Apr 17, 2019
Here's some more info on these and other emacs shortcuts supported in MacOS: https://jblevins.org/log/kbd.
shiftkey commentedon Apr 24, 2019
I started on a rough patch to see what it would take to get this working:
There's a few other places in the codebase where we look for
'ArrowDown'or'ArrowUp'events, but I think this is an interesting issue for a contributor with macOS who wants to improve these interactions to take a shot at this, so I'm going to mark this ashelp-wanted.narsaynorath commentedon Oct 5, 2019
Hi all, I made a PR that implements @shiftkey's idea in the files where
ArrowDownorArrowUpare used. Let me know if there's any feedback or if there might be tests I need to update.agisilaos commentedon Dec 13, 2021
@niik I'm planning to work on this so I'm assigning myself.
Move through lists with ⌃N and ⌃P
Move through lists with ⌃N and ⌃P
Move through lists with ⌃N and ⌃P