Repository: microsoft/terminal (language: cpp)

Issue:
[1.21] Clicking on the right side of a combobox doesn't cause it to open / dropdown
### Windows Terminal version

1.21.1011.0

### Windows build number

10.0.19045.3448

### Other Software

_No response_

### Steps to reproduce

look the video
https://github.com/microsoft/terminal/assets/11919060/f5c52bf2-d51c-482c-9dfc-557d919ec554

ps. for future is good idea post issue like BUG for CANARY builds WT?



### Expected Behavior

good work wit combobox 
latest good canary buid:  terminal-1.21.931.0

### Actual Behavior

terminal-1.21.991.0
terminal-1.21.1011.0
is bad for work with combobox




Discussion / hints:
> for future is good idea post issue like BUG for CANARY builds WT

Yes absolutely! If you're using canary and find bugs in it, absolutely file them here 😄 

----

21.931 included the font face combo box, so that wasn't the source of this regression. 
Here are the commits for that version range:

```
1.21.991.0 (bad ) -> * b90eb93d2 Localization Updates - main - 04/06/2024 03:04:16 (#17025)
                     * 156b9aeea Make marks a stable feature (#16938)
                     * c3f44f773 Rewrite how marks are stored & add reflow (#16937)
                     * dc4026d18 Add support for restoring non-terminal panes, and opening them with `splitPane`, `newTab` (#16914)
                     * c063d2bad Change default pane keybindings to duplicate, rather than use default profile (#16951)
                     * 6a69b94fc Increase usage of fmt and FMT_COMPILE (#17012)
                     * 8d6e7a8a7 Buffer Restore: Fix serializing >32KiB (#17022)
                     * 1a6ba43dd Get rid of UpdateTerminalSettings (#17009)
                     * 67ae9f6c3 Refactor the SettingsTab to be a pane (#16172)
1.21.931.0 (good) -> * 2bcbe6b49 ci/rel: publish symbols using the internal symbol request API instead (#16991)
```
@zadjii-msft just a cold read, but due to 67ae9f6c3 you may be the killer
You know, this is pretty dang painful. Promoting to blocking to investigate


Notes:


Wait a sec this doesn't repro on the canary build I have open on this machine anymore. What the hay barrels? Did I lose the repro?

okay definitely repros on main. Click on the right side of the combobox, and slowly move to the left. Usually there's a point where it starts working?

* [x] ❌ 32fbb16d4 main
* [x] ❌ f49cf44b799b4a4017ab7dce5c29694cda0fe725 Add more TraceLogging to ApiDispatchers (#17085)
* [x] ❌ 8bd9578b3ca9d18ba362ce1fff9b396d426b39e9  Fix: UI style errors: Menu items capitalization and … (ellipses) mark misuse (#16886)
* [x] ❌ c063d2bad68d46525a1fc693f4ff1d1c136b6f60 Change default pane keybindings to duplicate, rather than use default profile (#16951)
* [x] ❌1a6ba43dd220d4a318627006bf2a6c8b9a70c7bc Get rid of UpdateTerminalSettings (#17009)
* [ ] 67ae9f6c3e42e1ad3431ca02123fcfce57eef188 Refactor the SettingsTab to be a pane (#16172)
* [ ] ✅ 2bcbe6b49 ci/rel: publish symbols using the internal symbol request API instead (#16991)


67ae9f6c3e42e1ad3431ca02123fcfce57eef188 is the first bad commit
![48ed8be3-eafd-4cf4-9969-cdb317837a95](https://github.com/microsoft/terminal/assets/18356694/7985a3cd-44de-4a4a-a106-cc75c0ac5a45)

* On the non-retemplated ones, it's just the arrow region that doesn't open it. 
* On the retemplated ones, it's anything except the label that doesn't open it

Fix patch:
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 <conattrs.hpp>
 #include "MySettings.g.h"
 
-using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, uint32_t>;
+using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
 using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
 
 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<Pane> first,
@@ -88,14 +82,8 @@ Pane::Pane(std::shared_ptr<Pane> 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()
 // - <none>
 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<Pane>
 
     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 @@
         <local:SettingContainer x:Uid="Globals_Language"
                                 Visibility="{x:Bind ViewModel.LanguageSelectorAvailable}">
             <ComboBox ItemsSource="{x:Bind ViewModel.LanguageList}"
-                      SelectedItem="{x:Bind ViewModel.CurrentLanguage, Mode=TwoWay}">
+                      SelectedItem="{x:Bind ViewModel.CurrentLanguage, Mode=TwoWay}"
+                      Style="{StaticResource ComboBoxSettingStyle}">
                 <ComboBox.ItemTemplate>
                     <DataTemplate x:DataType="x:String">
                         <TextBlock Text="{x:Bind local:GlobalAppearanceViewModel.LanguageDisplayConverter((x:String))}" />


Test patch: