diff --git a/scratch/ScratchIslandApp/SampleApp/MySettings.h b/scratch/ScratchIslandApp/SampleApp/MySettings.h index 3e490416d9a..d73290390e2 100644 --- a/scratch/ScratchIslandApp/SampleApp/MySettings.h +++ b/scratch/ScratchIslandApp/SampleApp/MySettings.h @@ -11,7 +11,7 @@ Licensed under the MIT license. #include #include "MySettings.g.h" -using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap; +using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap; using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap; namespace winrt::SampleApp::implementation diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index ac599612359..fd195d8d42a 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -47,14 +47,8 @@ Pane::Pane(const IPaneContent& content, const bool lastFocused) : // LOAD-BEARING: This will NOT work if the border's BorderBrush is set to // Colors::Transparent! The border won't get Tapped events, and they'll fall // through to something else. - _borderFirst.Tapped([this](auto&, auto& e) { - _FocusFirstChild(); - e.Handled(true); - }); - _borderSecond.Tapped([this](auto&, auto& e) { - _FocusFirstChild(); - e.Handled(true); - }); + _borderFirst.Tapped({ this, &Pane::_borderTappedHandler }); + _borderSecond.Tapped({ this, &Pane::_borderTappedHandler }); } Pane::Pane(std::shared_ptr first, @@ -88,14 +82,8 @@ Pane::Pane(std::shared_ptr first, // LOAD-BEARING: This will NOT work if the border's BorderBrush is set to // Colors::Transparent! The border won't get Tapped events, and they'll fall // through to something else. - _borderFirst.Tapped([this](auto&, auto& e) { - _FocusFirstChild(); - e.Handled(true); - }); - _borderSecond.Tapped([this](auto&, auto& e) { - _FocusFirstChild(); - e.Handled(true); - }); + _borderFirst.Tapped({ this, &Pane::_borderTappedHandler }); + _borderSecond.Tapped({ this, &Pane::_borderTappedHandler }); } // Extract the terminal settings from the current (leaf) pane's control @@ -1237,6 +1225,14 @@ void Pane::UpdateVisuals() // - void Pane::_Focus() { + // Don't focus our content if we're already focused. This prevents a bug + // where tapping on the arrow in a ComboBox will land in our Tapped handler, + // and if we steal focus from the ComboBox, it won't open. See GH#17062 + if (WasLastFocused()) + { + return; + } + GotFocus.raise(shared_from_this(), FocusState::Programmatic); if (const auto& lastContent{ GetLastFocusedContent() }) { @@ -3021,3 +3017,9 @@ winrt::Windows::UI::Xaml::Media::SolidColorBrush Pane::_ComputeBorderColor() return _themeResources.unfocusedBorderBrush; } + +void Pane::_borderTappedHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::Windows::UI::Xaml::Input::TappedRoutedEventArgs& e) +{ + _FocusFirstChild(); + e.Handled(true); +} diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index 67daee1694f..f25a7b0834a 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -314,6 +314,8 @@ class Pane : public std::enable_shared_from_this SplitState _convertAutomaticOrDirectionalSplitState(const winrt::Microsoft::Terminal::Settings::Model::SplitDirection& splitType) const; + void _borderTappedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::Input::TappedRoutedEventArgs& e); + // Function Description: // - Returns true if the given direction can be used with the given split // type. diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml index 510779c27a3..26bb23a4149 100644 --- a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml @@ -31,7 +31,8 @@ + SelectedItem="{x:Bind ViewModel.CurrentLanguage, Mode=TwoWay}" + Style="{StaticResource ComboBoxSettingStyle}">