File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10231,6 +10231,7 @@ impl Workspace {
1023110231 self.show_tab_group_right_click_menu = None;
1023210232 self.show_tab_selection_right_click_menu = None;
1023310233 self.hide_move_to_group_sidecar(ctx);
10234+ self.focus_active_tab(ctx);
1023410235 ctx.notify();
1023510236 }
1023610237 MenuEvent::ItemHovered | MenuEvent::ItemSelected => {
Original file line number Diff line number Diff line change @@ -2464,6 +2464,41 @@ fn test_save_current_tab_as_new_config_ignores_stale_tab_index() {
24642464 } ) ;
24652465}
24662466
2467+ #[ test]
2468+ fn test_closing_tab_context_menu_restores_active_tab_focus ( ) {
2469+ App :: test ( ( ) , |mut app| async move {
2470+ initialize_app ( & mut app) ;
2471+
2472+ let workspace = mock_workspace ( & mut app) ;
2473+ let ( window_id, menu_id) = workspace. update ( & mut app, |workspace, ctx| {
2474+ workspace. show_tab_right_click_menu =
2475+ Some ( ( 0 , TabContextMenuAnchor :: Pointer ( Vector2F :: zero ( ) ) ) ) ;
2476+ ctx. focus ( & workspace. tab_right_click_menu ) ;
2477+ assert_eq ! (
2478+ ctx. focused_view_id( ctx. window_id( ) ) ,
2479+ Some ( workspace. tab_right_click_menu. id( ) )
2480+ ) ;
2481+
2482+ workspace. handle_tab_right_click_menu_event (
2483+ & MenuEvent :: Close {
2484+ via_select_item : true ,
2485+ } ,
2486+ ctx,
2487+ ) ;
2488+
2489+ ( ctx. window_id ( ) , workspace. tab_right_click_menu . id ( ) )
2490+ } ) ;
2491+
2492+ assert_ne ! ( app. focused_view_id( window_id) , Some ( menu_id) ) ;
2493+ workspace. read ( & app, |workspace, ctx| {
2494+ assert ! (
2495+ workspace
2496+ . active_tab_pane_group( )
2497+ . is_self_or_child_focused( ctx)
2498+ ) ;
2499+ } ) ;
2500+ } ) ;
2501+ }
24672502#[ test]
24682503fn test_close_tabs_right_confirmation_dialog ( ) {
24692504 let _guard = FeatureFlag :: CreatingSharedSessions . override_enabled ( true ) ;
You can’t perform that action at this time.
0 commit comments