feat: add a keyboard shortcut for collapsing the Object Explorer - #10296
Open
dpage wants to merge 1 commit into
Open
feat: add a keyboard shortcut for collapsing the Object Explorer#10296dpage wants to merge 1 commit into
dpage wants to merge 1 commit into
Conversation
pgadmin-org#10254 made the Object Explorer collapsible by clicking the current workspace icon, but left that as the only way to do it. This adds a shortcut, Ctrl+Alt+B by default, registered as its own toggle_object_explorer preference so anyone can change it. Ctrl+Alt+B rather than anything in the Shift+Alt family, which is full: b, f, o, l, h, q, v, s, n, e, d and g are all taken, b by the existing Object Explorer shortcut, which keeps its meaning of focusing the tree. Ctrl+Alt+B is close enough to VS Code's Ctrl+B for the side bar to be guessable, and keeps a family resemblance to the bracket keys used for tab navigation. Ctrl+Shift+B would have been the other obvious candidate, but Chrome and Firefox both use it for the bookmarks bar. Worth noting for anyone reviewing: on keyboard layouts where AltGr is Ctrl+Alt, this combination can be swallowed by the layout and produce a character instead. That is true of any Ctrl+Alt binding, the preference is user-configurable, and Shift+Ctrl+Alt+B is available if the default turns out to annoy people. The shortcut itself only fires an event, since the workspace provider owns the visibility state, and the provider ignores it in classic layout where there is no workspace toolbar and the Object Explorer is always shown. Tested in a browser as well as in the unit tests: from the workspace layout the key collapses and restores the panel, and the preference is registered alongside the existing shortcuts.
|
Caution Review failedAn error occurred during the review process. Please try again later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#10254 made the Object Explorer collapsible by clicking the current workspace icon, but that click is currently the only way to do it. This adds a keyboard shortcut,
Ctrl+Alt+Bby default, registered as its owntoggle_object_explorerpreference so it can be changed like any other.Why Ctrl+Alt+B
The
Shift+Alt+<letter>family is full: b, f, o, l, h, q, v, s, n, e, d and g are all taken, and b belongs to the existing Object Explorer shortcut, which keeps its present meaning of focusing the tree.Ctrl+Alt+Bis free, sits close enough to VS Code'sCtrl+Bfor the side bar to be guessable, and keeps a family resemblance to the bracket keys used for tab navigation.Ctrl+Shift+Bwas the other obvious candidate and I avoided it, since Chrome and Firefox both use it for the bookmarks bar.One caveat worth raising rather than burying: on keyboard layouts where AltGr is Ctrl+Alt, this combination can be swallowed by the layout and produce a character instead. That applies to any
Ctrl+Altbinding, the preference is user-configurable, andShift+Ctrl+Alt+Bis available if the default turns out to irritate people. Happy to change the default if reviewers prefer.Shape of the change
The shortcut only fires a
pgadmin:object-explorer:toggleevent, because the workspace provider owns the visibility state, and the provider ignores it in classic layout, where there is no workspace toolbar and the Object Explorer is always shown.Testing
web/regression/javascript/browser/keyboard_toggle_object_explorer_spec.jscovers the shortcut asking for the toggle, andWorkspaceProvider.spec.jsxgains a case for the provider acting on it in both directions.Also driven in a browser: in the workspace layout,
Ctrl+Alt+Bcollapses the panel and a second press restores it, witharia-pressedon the workspace icon following along, and the new preference appears alongside the existing shortcuts.Documented in
docs/en_US/keyboard_shortcuts.rst. No release note entry, per the usual practice of batching those shortly before release.