Skip to content

fix: preserve the active page when removing earlier tabs#1220

Open
officialasishkumar wants to merge 1 commit intovercel-labs:mainfrom
officialasishkumar:fix/preserve-active-tab-on-close
Open

fix: preserve the active page when removing earlier tabs#1220
officialasishkumar wants to merge 1 commit intovercel-labs:mainfrom
officialasishkumar:fix/preserve-active-tab-on-close

Conversation

@officialasishkumar
Copy link
Copy Markdown

Summary

  • preserve the same logical active page when a tab before it is removed
  • apply the same adjustment to both tab close and destroyed-target cleanup
  • add regression tests for earlier-tab removal, later-tab removal, last-tab clamping, and the empty-page case

Closes #1219.

Validation

  • cargo fmt --manifest-path cli/Cargo.toml
  • cargo test --manifest-path cli/Cargo.toml active_page_index_after_removal
  • cargo test --manifest-path cli/Cargo.toml tab_
  • manual CLI validation with AGENT_BROWSER_ARGS=--no-sandbox: open A/B/C/D, switch to C, run tab close 0, verify get title still returns C and the active tab is now index 1
  • cargo clippy --manifest-path cli/Cargo.toml --all-targets -- -D warnings

Adjust tab-removal bookkeeping so closing or losing a page before the active tab keeps the session pointed at the same logical page instead of silently shifting to the next one.

Add regression coverage for earlier-tab removal, later-tab removal, last-tab clamping, and the empty-page case.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 12, 2026

@officialasishkumar is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

tab close of an earlier tab can silently retarget the active page

1 participant