Compare commits

...

3 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
da4b02306f Fix tab navigation in search results by making SettingsGroup headers focusable
Co-authored-by: davidegiacometti <25966642+davidegiacometti@users.noreply.github.com>
2025-09-09 18:58:56 +00:00
copilot-swe-agent[bot]
ce69603d16 Initial analysis: Identify tab navigation issue in SearchResultsPage
Co-authored-by: davidegiacometti <25966642+davidegiacometti@users.noreply.github.com>
2025-09-09 18:54:17 +00:00
copilot-swe-agent[bot]
e3efd75aa0 Initial plan 2025-09-09 18:50:20 +00:00
3 changed files with 39 additions and 1 deletions

View File

@@ -65,6 +65,14 @@
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Unfocused" />
<VisualState x:Name="Focused">
<VisualState.Setters>
<Setter Target="HeaderPresenter.Foreground" Value="{ThemeResource SystemAccentColor}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>

View File

@@ -25,6 +25,11 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
public SettingsGroup()
{
DefaultStyleKey = typeof(SettingsGroup);
UpdateTabStop();
// Handle focus state changes for visual feedback
GotFocus += OnGotFocus;
LostFocus += OnLostFocus;
}
[Localizable(true)]
@@ -38,7 +43,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
"Header",
typeof(string),
typeof(SettingsGroup),
new PropertyMetadata(default(string)));
new PropertyMetadata(default(string), OnHeaderChanged));
[Localizable(true)]
public object Description
@@ -68,6 +73,11 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
((SettingsGroup)d).Update();
}
private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((SettingsGroup)d).UpdateTabStop();
}
private void SettingsGroup_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
SetEnabledState();
@@ -95,6 +105,26 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
}
}
private void UpdateTabStop()
{
// Make the SettingsGroup focusable only when it has a header
// This allows keyboard navigation to group headers in search results
IsTabStop = !string.IsNullOrEmpty(Header);
}
private void OnGotFocus(object sender, RoutedEventArgs e)
{
if (IsTabStop)
{
VisualStateManager.GoToState(this, "Focused", true);
}
}
private void OnLostFocus(object sender, RoutedEventArgs e)
{
VisualStateManager.GoToState(this, "Unfocused", true);
}
protected override AutomationPeer OnCreateAutomationPeer()
{
return new SettingsGroupAutomationPeer(this);

0
tools/build/build.cmd Normal file → Executable file
View File