feat: add a keyboard shortcut for collapsing the Object Explorer - #10296
feat: add a keyboard shortcut for collapsing the Object Explorer#10296dpage wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe change adds a configurable Object Explorer keyboard shortcut. Keyboard handling emits a toggle event. Workspace layouts respond to the event, while classic layout remains unchanged. Documentation and regression tests cover the new behavior. ChangesObject Explorer Toggle
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change adds a configurable keyboard shortcut for toggling the Object Explorer without introducing an actionable merge-blocking risk; it is merge-ready after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant KeyboardNavigation
participant BrowserEvents as pgAdmin.Browser.Events
participant WorkspaceProvider
KeyboardNavigation->>BrowserEvents: trigger TOGGLE_OBJECT_EXPLORER_EVENT
BrowserEvents->>WorkspaceProvider: notify toggle listener
WorkspaceProvider->>WorkspaceProvider: toggle Object Explorer visibility
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 6 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
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.
2e3337e to
0edc54e
Compare
|
@hiteshjambhale I've rebased this branch onto current |
#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.Summary by CodeRabbit
New Features
Ctrl + Alt + BCtrl + Option + BDocumentation
Tests