Restore focus after closing tab context menus - #16138
Merged
Merged
Conversation
Avoid indexing a tab position captured by a context menu after another action has changed the tab list. Add a regression for closing other tabs before the stale save action is dispatched.\n\nCo-Authored-By: Warp Agent <agent@warp.dev>
Contributor
Author
|
This PR was generated with Warp. Comment |
acarl005
marked this pull request as ready for review
September 24, 2026 15:56
acarl005
marked this pull request as ready for review
September 24, 2026 17:21
acarl005
marked this pull request as ready for review
September 24, 2026 17:43
acarl005
marked this pull request as ready for review
September 24, 2026 17:44
acarl005
approved these changes
Sep 24, 2026
acarl005
enabled auto-merge (squash)
September 24, 2026 17:55
acarl005
disabled auto-merge
September 24, 2026 17:55
acarl005
enabled auto-merge (squash)
September 24, 2026 17:55
zhangyu1818-bot
added a commit
to zhangyu1818/warply
that referenced
this pull request
Sep 25, 2026
Port of upstream 43eae5e (warpdotdev#16138). Closing a tab context menu hid the overlay but left its Menu view focused, so later keystrokes dispatched stale positional actions. focus_active_tab is now called on MenuEvent::Close, and save_current_tab_as_new_config uses a checked tab lookup as defense in depth. Tests remapped from upstream view_tests.rs to the fork's view_test.rs after the close-tab test family; bodies applied verbatim. Upstream df5cacf (docs: WARP_SKIP_COMMON_SKILLS_INSTALL) rejected: the fork has no common-skills installer to document. See docs/agents-wiki/upstream-master-audit-2026-09-25.md.
jwp2987
pushed a commit
to jwp2987/phosphor
that referenced
this pull request
Sep 27, 2026
Port of upstream 43eae5e (warpdotdev#16138), newer than pin 4111d08. Refs #TBD — issue not yet filed (gh auth down); draft in the round's scratchpad. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TranscriptionFactory
pushed a commit
to TranscriptionFactory/warp
that referenced
this pull request
Sep 28, 2026
Two fixes: closing a tab context menu left focus on the hidden menu view, so the keyboard went nowhere until the user clicked; and SaveCurrentTabAsNewConfig indexed self.tabs directly, panicking on a stale tab index (e.g. after close_other_tabs shrank the list). Fork adaptations: - Kept our simpler handle_tab_right_click_menu_event. This fork has no tab group / multi-select context menus and no move-to-group sidecar, so the upstream arms for those have nothing to clear here; only the focus_active_tab call is the fix. - Tests go in view_test.rs (this fork's name); upstream's view_tests.rs is not wired into the module tree here. Verified: cargo check -p warp --lib --tests clean. The two new tests are not runnable locally: all of workspace::view::tests (43 of 45, including tests untouched by this change) fails on an unregistered AgentProviderSecrets singleton, a pre-existing local harness breakage. (cherry picked from commit 43eae5e08e57e70a6f0e1d75e1e69aba8d1fedb4)
zhangyu1818-bot
added a commit
to zhangyu1818/warply
that referenced
this pull request
Oct 1, 2026
Port of upstream 43eae5e (warpdotdev#16138). Closing a tab context menu hid the overlay but left its Menu view focused, so later keystrokes dispatched stale positional actions. focus_active_tab is now called on MenuEvent::Close, and save_current_tab_as_new_config uses a checked tab lookup as defense in depth. Tests remapped from upstream view_tests.rs to the fork's view_test.rs after the close-tab test family; bodies applied verbatim. Upstream df5cacf (docs: WARP_SKIP_COMMON_SKILLS_INSTALL) rejected: the fork has no common-skills installer to document. See docs/agents-wiki/upstream-master-audit-2026-09-25.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Closing a tab context menu hid the overlay but left its
Menuview focused. In the Sentry event, the user selected “Close other tabs” for tab index 5, then switched away. Almost two minutes later the window regained focus andSelect(Next)plusEnterwere routed to the hidden menu, which dispatched the adjacent “Save as new config” action still carrying index 5 after the tab list had shrunk to one item.Restore focus to the active tab whenever the tab context menu closes so hidden menus cannot continue handling keyboard input. Keep a checked tab lookup as defense in depth for positional actions that become stale before dispatch. Valid menu and save behavior is unchanged. This addresses Sentry fatal WARP-CLIENT-BETA-STABLE-8C2M / issue
7751633023.Computer-use video recordings
Warp tab context menu - Close other tabs, then Down+Enter after focus change: Recording right-click on the 6th tab, opening its context menu, selecting Close other tabs, confirming one tab remains, moving focus away and back to the Warp window, then pressing Down once and Enter once, observing the final state.
Computer-use screenshots
Final stable Warp state after Close other tabs, focus-away-and-back, then Down+Enter: one tab ("New session") remains, no context menu/modal/editor is visible, and a faint overlapping/ghosted debug-style text ("Lines: 4 ...; Size ... KB (grid: 12.9 KB, flat: 5.1 KB)") appears near the bottom of the pane above the "Run commands" placeholder input.
Linked Issue
Testing
Added regressions that verify closing the tab context menu restores focus to the active tab and that a stale save action cannot panic if its tab no longer exists.
On Ubuntu 24.04 x86_64 at exact commit
8ebe655ec15f49deb690c6d8bef28ea0b66326f6,cargo build --bin warppassed. Rendered verification created six tabs, used “Close other tabs” on tab 6, moved focus away and back, then pressed Down and Enter. Warp stayed open, the hidden menu did not handle the keys, the terminal remained the input target, no tab-config UI or file appeared, and noSaveCurrentTabAsNewConfigaction was logged.Authentication caveat: the fresh profile opened onboarding despite
WARP_API_KEYand later loggedUnauthorized: Expected a user account, so the requested authenticated-launch prerequisite was not satisfied. This is qualified verification of the rendered focus behavior, not a successful authenticated fresh-profile launch.The focused tests and targeted Clippy were initially attempted locally with a single build job, but the 4 GB sandbox killed
rustc/clippy-driverwith SIGKILL. The first CI run exposed an immutable-versus-mutableAppContextmismatch in the new focus test; commit8c6a89d18eb9de1ce830aefc17d75d5a36dce689fixed that compile error. A focused run then exposed a same-update focus assertion; head commit334c5c74b52bc0cc3af6bdc740e2845d75405521moves that observation across the app update boundary.cargo nextest run -p warp -E 'test(test_closing_tab_context_menu_restores_active_tab_focus)'passes (1 passed, 6,861 skipped), as docargo fmt --all --checkandgit diff --check. The fresh CI matrix is pending on the validated head.Agent Mode
CHANGELOG-BUG-FIX: Fixed hidden tab context menus handling keyboard input after being closed.