Skip to content

feat: add a keyboard shortcut for collapsing the Object Explorer - #10296

Open
dpage wants to merge 1 commit into
pgadmin-org:masterfrom
dpage:feature/object-explorer-toggle-shortcut
Open

feat: add a keyboard shortcut for collapsing the Object Explorer#10296
dpage wants to merge 1 commit into
pgadmin-org:masterfrom
dpage:feature/object-explorer-toggle-shortcut

Conversation

@dpage

@dpage dpage commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

#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+B by default, registered as its own toggle_object_explorer preference 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+B is free, sits 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 was 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+Alt binding, the preference is user-configurable, and Shift+Ctrl+Alt+B is 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:toggle event, 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.js covers the shortcut asking for the toggle, and WorkspaceProvider.spec.jsx gains a case for the provider acting on it in both directions.

Also driven in a browser: in the workspace layout, Ctrl+Alt+B collapses the panel and a second press restores it, with aria-pressed on 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

    • Added a keyboard shortcut to toggle the Object Explorer:
      • Windows/Linux: Ctrl + Alt + B
      • macOS: Ctrl + Option + B
    • The shortcut collapses or restores the Object Explorer in workspace layouts.
  • Documentation

    • Updated keyboard shortcut documentation with the new toggle command.
  • Tests

    • Added coverage confirming the shortcut and visibility toggle work correctly.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2237611b-5b75-48ca-808d-36cf88fcd541

📥 Commits

Reviewing files that changed from the base of the PR and between bc58657 and 0edc54e.

📒 Files selected for processing (7)
  • docs/en_US/keyboard_shortcuts.rst
  • web/pgadmin/browser/register_browser_preferences.py
  • web/pgadmin/browser/static/js/constants.js
  • web/pgadmin/browser/static/js/keyboard.js
  • web/pgadmin/misc/workspaces/static/js/WorkspaceProvider.jsx
  • web/regression/javascript/browser/keyboard_toggle_object_explorer_spec.js
  • web/regression/javascript/workspaces/WorkspaceProvider.spec.jsx

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

The 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.

Changes

Object Explorer Toggle

Layer / File(s) Summary
Shortcut preference and documentation
web/pgadmin/browser/register_browser_preferences.py, docs/en_US/keyboard_shortcuts.rst
Registers toggle_object_explorer with Ctrl+Alt+B and documents the Windows/Linux and Mac shortcuts.
Keyboard event dispatch
web/pgadmin/browser/static/js/constants.js, web/pgadmin/browser/static/js/keyboard.js
Exports TOGGLE_OBJECT_EXPLORER_EVENT, reads the preference, binds the shortcut, and triggers the event.
Workspace visibility handling and tests
web/pgadmin/misc/workspaces/static/js/WorkspaceProvider.jsx, web/regression/javascript/browser/keyboard_toggle_object_explorer_spec.js, web/regression/javascript/workspaces/WorkspaceProvider.spec.jsx
Toggles Object Explorer visibility in workspace layouts, excludes classic layout, and tests event dispatch and visibility changes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 0edc5

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
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: adding a keyboard shortcut for the Object Explorer. It is concise and directly related to the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

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)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hiteshjambhale
hiteshjambhale self-requested a review August 18, 2026 10:12

@hiteshjambhale hiteshjambhale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jest specs pass and verified the ⌃⌥B toggle + persistence in-browser on macOS.
LGTM.
Kindly handle failing checks.

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.
@dpage
dpage force-pushed the feature/object-explorer-toggle-shortcut branch from 2e3337e to 0edc54e Compare August 25, 2026 08:53
@dpage

dpage commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

@hiteshjambhale I've rebased this branch onto current upstream/master, which picks up #10306 (a CI infrastructure fix for the Yarn/Corepack setup that was causing the broad check failures here). Checks should now pass on the rerun.

@kundansable kundansable added this to the 9.18 milestone Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants