Skip to content
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

Keyboard shortcuts for interactive CLI #37

Closed
DmitrySharabin opened this issue Jun 3, 2024 · 3 comments · Fixed by #38
Closed

Keyboard shortcuts for interactive CLI #37

DmitrySharabin opened this issue Jun 3, 2024 · 3 comments · Fixed by #38
Labels
enhancement New feature or request

Comments

@DmitrySharabin
Copy link
Collaborator

Initially, this came from Lea's proposal where Lea suggested adding two new keyboard shortcuts:

  • Shift+→ — “Expand All”
  • Shift+← — “Collapse All“

I would also add:

  • Shift+↑ — “Go to Top”
  • Shift+↓ — “Go to Bottom”
  • Alt+→ — “Expand Subtree” (starting from the current node) — the same as “Expand All” when performed on root
  • Alt+← — “Collapse Subtree” (starting from the current node) — the same as “Collapse All” when performed on root

And one more thing that might enhance the current behavior of : press ones — collapse the current node (the current behavior), second press — collapse the parent node, third press — collapse the grandparent node, etc. This should increase speed a bit when working with the results.

Thoughts?

@DmitrySharabin DmitrySharabin added the enhancement New feature or request label Jun 3, 2024
@LeaVerou
Copy link
Collaborator

LeaVerou commented Jun 3, 2024

I love it. Where do the shortcuts come from? Have you found any established conventions in other collapsible trees?

@DmitrySharabin
Copy link
Collaborator Author

Where do the shortcuts come from? Have you found any established conventions in other collapsible trees?

Unfortunately, I couldn't find any established conventional shortcuts when working with collapsible trees except the one that operation systems provide for file/folder trees.

They use arrow keys to navigate the tree one level. The Alt key modifies the default behavior, such as going to the first or last node in the current subtree. Combined with Ctrl and Alt, the arrow keys can be used to perform actions on the level of the whole tree (where applicable).

Using the Shift key to navigate to the top or bottom was not a good idea—in general, the Shift key is used to select consequent nodes (files/folders).

So, I would end up with the following shortcuts:

  • — “Go Level Up” (current behavior)
  • — “Go Level Down” (current behavior)
  • — “Expand Node” (current behavior)
  • — “Collapse Node” (current behavior)
  • Alt+↑ — “Go to Top of the Subtree”
  • Alt+↓ — “Go to Bottom of the Subtree”
  • Alt+→ — “Expand Subtree” (starting from the current node) — the same as “Expand All” when performed on root
  • Alt+← — “Collapse Subtree” (starting from the current node) — the same as “Collapse All” when performed on root
  • Alt+Ctrl+→ — “Expand All”
  • Alt+Ctrl+← — “Collapse All”
  • Consequent presses of collapse the current node, then—the parent node, then—the grandparent node, and so on.

@LeaVerou
Copy link
Collaborator

LeaVerou commented Jun 7, 2024

No strong opinion on the modifiers besides that I agree you should need two modifiers for the expand/collapse all behavior. Given that we don't have a selection concept, I think it's fine to use Shift. Or even Ctrl. Not sure I'd try Alt if I were to guess what shortcut might work, but I don't have a strong opinion against it. Just make sure that the code makes it easy to change in the future, and please document these shortcuts in the docs about how that test runner works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants