File tree Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,18 @@ namespace winrt::TerminalApp::implementation
5555 });
5656 }
5757
58+ // Method Description:
59+ // - Returns true if we're in the middle of a tab rename. This is used to
60+ // mitigate GH#10112.
61+ // Arguments:
62+ // - <none>
63+ // Return Value:
64+ // - true if the renamer is open.
65+ bool TabHeaderControl::InRename ()
66+ {
67+ return Windows::UI::Xaml::Visibility::Visible == HeaderRenamerTextBox ().Visibility ();
68+ }
69+
5870 // Method Description:
5971 // - Show the tab rename box for the user to rename the tab title
6072 // - We automatically use the previous title as the initial text of the box
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ namespace winrt::TerminalApp::implementation
1818 void RenameBoxLostFocusHandler (winrt::Windows::Foundation::IInspectable const & sender,
1919 winrt::Windows::UI::Xaml::RoutedEventArgs const & e);
2020
21+ bool InRename ();
22+
2123 WINRT_CALLBACK (TitleChangeRequested, TerminalApp::TitleChangeRequestedArgs);
2224
2325 WINRT_CALLBACK (PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler);
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ namespace TerminalApp
1414 TabHeaderControl();
1515 void BeginRename();
1616
17+ Boolean InRename { get; };
18+
1719 TerminalTabStatus TabStatus { get; set; };
1820
1921 event TitleChangeRequestedArgs TitleChangeRequested;
Original file line number Diff line number Diff line change @@ -870,7 +870,13 @@ namespace winrt::TerminalApp::implementation
870870 contextMenuFlyout.Closed ([weakThis](auto &&, auto &&) {
871871 if (auto tab{ weakThis.get () })
872872 {
873- tab->_RequestFocusActiveControlHandlers ();
873+ // GH#10112 - if we're opening the tab renamer, don't
874+ // immediately toss focus to the control. We don't want to steal
875+ // focus from the tab renamer.
876+ if (!tab->_headerControl .InRename ())
877+ {
878+ tab->_RequestFocusActiveControlHandlers ();
879+ }
874880 }
875881 });
876882 _AppendCloseMenuItems (contextMenuFlyout);
You can’t perform that action at this time.
0 commit comments