Skip to content

Select the adjacent tab when the active tab is closed, rather than the left-most. #9130 - #10578

Closed
dpage wants to merge 1 commit into
pgadmin-org:masterfrom
dpage:fix/issue-9130-adjacent-tab-on-close
Closed

dpage wants to merge 1 commit into
pgadmin-org:masterfrom
dpage:fix/issue-9130-adjacent-tab-on-close

Conversation

@dpage

@dpage dpage commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Closing the active tab selected the tab to its right, or the left-most tab when there was none, so closing the right-most tab scrolled the tab bar back to the start (rc-dock's default). LayoutDocker.close() now activates the right neighbour or, failing that, the left one before removing the tab, matching Chrome. Closing an inactive tab leaves the selection alone, as before.

Test plan

  • New Jest cases in LayoutDocker.spec.js (right-most, middle, inactive and only-tab closes); the right-most case fails without the fix.
  • Checked against a real rc-dock DockLayout in jsdom that the saved layout records the new active tab.

Closes #9130

Summary by CodeRabbit

  • Bug Fixes
    • Closing the active tab now selects the tab immediately to its right, or the tab to its left when closing the rightmost tab. Closing an inactive tab preserves the current selection.

…e left-most. pgadmin-org#9130

rc-dock selects the tab to the right of a closed active tab, but falls
back to the first tab when there is none, so closing the right-most tab
scrolled the tab bar back to the start. Activate the right neighbour or,
failing that, the left one before removing the tab, matching browsers.

Closes pgadmin-org#9130
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pgadmin-org/pgadmin4/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9da65a21-66c1-4d6d-bbce-270d32f26d4f
📥 Commits

Reviewing files that changed from the base of the PR and between 607c9ec and b3e8d72.

📒 Files selected for processing: 2
  • web/pgadmin/static/js/helpers/Layout/index.jsx
  • web/regression/javascript/helpers/LayoutDocker.spec.js

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

Walkthrough

When LayoutDocker.close closes the active tab, it now selects the tab to its right, or the tab to its left when no right neighbor exists. Tests cover active, inactive, and only-tab cases.

Changes

Tab Close Selection

Layer / File(s) Summary
Active tab close behavior
web/pgadmin/static/js/helpers/Layout/index.jsx, web/regression/javascript/helpers/LayoutDocker.spec.js
LayoutDocker.close selects the right neighbor, or the left neighbor when no right neighbor exists, before removing the active tab. Tests check active-tab selection and confirm that closing an inactive tab preserves selection and closing the only tab does not select another.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to b3e8d

No identified issue blocks merging the adjacent-tab selection change after normal checks.

Pre-merge checks: Passed 5
Passed Passed checks: 5 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main change: selecting an adjacent tab instead of the left-most tab when the active tab closes.
Linked Issues check Passed Issue #9130 requires an adjacent tab to remain selected when the active tab closes. LayoutDocker.close() checks the active tab, focuses the immediate right tab, and otherwise focuses the immediate l…
Out of Scope Changes check Passed The reviewed changes are limited to LayoutDocker.close() and its focused Jest coverage. The implementation and tests directly support issue #9130. No unrelated behavior or files are included in the …
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

dpage added a commit that referenced this pull request Oct 15, 2026
@dpage

dpage commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Squashed and merged as 610cad0.

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.

Closing a tab shouldn't reset the selection to the left-most tab

1 participant