Closed DmitrySharabin closed 5 months ago
I love it. Where do the shortcuts come from? Have you found any established conventions in other collapsible trees?
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 rootAlt+←
— “Collapse Subtree” (starting from the current node) — the same as “Collapse All” when performed on rootAlt+Ctrl+→
— “Expand All”Alt+Ctrl+←
— “Collapse All”←
collapse the current node, then—the parent node, then—the grandparent node, and so on.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.
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 rootAlt+←
— “Collapse Subtree” (starting from the current node) — the same as “Collapse All” when performed on rootAnd 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?