-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't always focus pane content on Tapped, if the pane is already focused #17174
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way for us to check if focus is currently inside our pane? Rather than us trying to remember it. |
||
{ | ||
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); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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}"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a drive-by that I discovered while investigating. |
||
<ComboBox.ItemTemplate> | ||
<DataTemplate x:DataType="x:String"> | ||
<TextBlock Text="{x:Bind local:GlobalAppearanceViewModel.LanguageDisplayConverter((x:String))}" /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another drive-by to fix the scratch app build