Activate next tab (below) after closing the active vertical tab#13142
Activate next tab (below) after closing the active vertical tab#13142elviskahoro wants to merge 1 commit into
Conversation
Make tab-close focus consistent across layouts. PR warpdotdev#11197 made horizontal tabs activate the tab to the right after closing the active tab, but it explicitly preserved the old vertical-tab behavior, which still activates the previous (up) tab. This unifies the two: closing the active tab now focuses the next tab (right for horizontal, below for vertical), falling back to the previous neighbor only when closing the last tab. Adds unit tests for the vertical case (next-tab activation and last-tab fallback), mirroring the existing horizontal tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @elviskahoro on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment |
|
Every PR must be linked to a same-repo issue before Oz can review it. Next step: open or find a same-repo issue describing this change, then link it to this PR by adding See the contribution guidelines for the full readiness model. Powered by Oz |
There was a problem hiding this comment.
Every PR must be linked to a same-repo issue before Oz can review it.
Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.
See the contribution guidelines for the full readiness model.
Powered by Oz
|
@bholmesdev I did the CLA check! lmk if this needs feature flag |
Summary
Closing the active tab should move focus to the next tab — the tab to the
right (horizontal) or below (vertical) — falling back to the previous neighbor
only when you close the last tab. This is the standard convention set by
browsers and macOS apps.
Today the behavior is inconsistent between layouts:
horizontal tab after close") changed the post-close selection from
index.saturating_sub(1)(previous tab) toindex.min(self.tabs.len() - 1)(next tab).
This is the part that confused us: PR #11197 explicitly scoped its fix to
horizontal mode and called out that it would "preserve existing vertical tab
behavior." It did so by gating the new logic behind
uses_vertical_tabs(ctx):We couldn't find a reason vertical tabs should intentionally focus the
previous tab while horizontal focuses the next one — it breaks the same
convention #11197 set out to fix, just in the other layout. If there is a
deliberate reason for the asymmetry, please flag it on this PR.
Change
Drop the layout branch in
Workspace::remove_taband always use thenext-neighbor rule for both layouts:
remove_tabis the single point all close paths funnel through (keyboard, thetab "X" button, the vertical-tabs panel, and tab-group closes), so this fixes
every entry point. Horizontal behavior is unchanged; only vertical tabs change
(previous → next).
Tests
test_close_active_horizontal_tab_activates_tab_to_right,test_close_last_horizontal_tab_activates_tab_to_left.test_close_active_vertical_tab_activates_tab_below(would have failed beforethis change),
test_close_last_vertical_tab_activates_tab_above(fallback).cargo check -p warp --testsclean; the four*_tab_activates_tab_*testspass.
Closes #13143