Skip to content

Commit 63fa9f3

Browse files
ssparachCopilot
andauthored
Accessibility Bug Fix: After selecting from the navigation list, keyboard focus is not transferred to page content (#14289)
* bug fix * Update src/windows/wslsettings/Views/Settings/OptionalFeaturesPage.xaml.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/windows/wslsettings/Views/Settings/NetworkingPage.xaml.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/windows/wslsettings/Views/Settings/MemAndProcPage.xaml.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/windows/wslsettings/Views/Settings/FileSystemPage.xaml.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/windows/wslsettings/Views/Settings/DeveloperPage.xaml.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d23a5c4 commit 63fa9f3

11 files changed

+53
-10
lines changed

src/windows/wslsettings/Views/Settings/DeveloperPage.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
xmlns:controls="using:WslSettings.Controls"
88
behaviors:NavigationViewHeaderBehavior.HeaderMode="Never">
99

10-
<Grid Margin="{ThemeResource ContentPageMargin}">
10+
<Grid Margin="{ThemeResource ContentPageMargin}"
11+
IsTabStop="True"
12+
AutomationProperties.LandmarkType="Main"
13+
x:Name="DeveloperPageRoot">
1114
<Grid.RowDefinitions>
1215
<RowDefinition Height="Auto" />
1316
<RowDefinition Height="Auto" />
1417
<RowDefinition Height="*" />
1518
</Grid.RowDefinitions>
16-
<TextBlock x:Uid="Settings_DeveloperPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left"/>
19+
<TextBlock x:Uid="Settings_DeveloperPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left" AutomationProperties.HeadingLevel="Level1"/>
1720
<TextBlock x:Uid="Settings_ErrorTryAgainLater" x:Name="Settings_ErrorTryAgainLater" Grid.Row="1" HorizontalAlignment="Left" AutomationProperties.LiveSetting="Assertive"
1821
Visibility="{x:Bind ViewModel.ErrorVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}"/>
1922
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto"

src/windows/wslsettings/Views/Settings/DeveloperPage.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public DeveloperPage()
3333

3434
private void OnPageLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
3535
{
36+
DeveloperPageRoot.Focus(FocusState.Programmatic);
3637
RuntimeHelper.SetupExpanderFocusManagementByName(this, "CustomKernelPathExpander", "CustomKernelPathTextBox");
3738
RuntimeHelper.SetupExpanderFocusManagementByName(this, "CustomKernelModulesPathExpander", "CustomKernelModulesPathTextBox");
3839
RuntimeHelper.SetupExpanderFocusManagementByName(this, "CustomSystemDistroPathExpander", "CustomSystemDistroPathTextBox");

src/windows/wslsettings/Views/Settings/FileSystemPage.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
xmlns:behaviors="using:WslSettings.Behaviors"
77
behaviors:NavigationViewHeaderBehavior.HeaderMode="Never">
88

9-
<Grid Margin="{ThemeResource ContentPageMargin}">
9+
<Grid Margin="{ThemeResource ContentPageMargin}"
10+
IsTabStop="True"
11+
AutomationProperties.LandmarkType="Main"
12+
x:Name="FileSystemPageRoot">
1013
<Grid.RowDefinitions>
1114
<RowDefinition Height="Auto" />
1215
<RowDefinition Height="Auto" />
1316
<RowDefinition Height="*" />
1417
</Grid.RowDefinitions>
15-
<TextBlock x:Uid="Settings_FileSystemPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left"/>
18+
<TextBlock x:Uid="Settings_FileSystemPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left" AutomationProperties.HeadingLevel="Level1"/>
1619
<TextBlock x:Uid="Settings_ErrorTryAgainLater" x:Name="Settings_ErrorTryAgainLater" Grid.Row="1" HorizontalAlignment="Left" AutomationProperties.LiveSetting="Assertive"
1720
Visibility="{x:Bind ViewModel.ErrorVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}"/>
1821
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto"

src/windows/wslsettings/Views/Settings/FileSystemPage.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (C) Microsoft Corporation. All rights reserved.
22

33
using CommunityToolkit.WinUI.Controls;
4+
using Microsoft.UI.Xaml;
45
using Microsoft.UI.Xaml.Automation.Peers;
56
using Microsoft.UI.Xaml.Controls;
67
using Microsoft.UI.Xaml.Navigation;
@@ -60,6 +61,7 @@ private void DefaultVHDSizeTextBox_TextChanged(object sender, TextChangedEventAr
6061

6162
private void OnPageLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
6263
{
64+
FileSystemPageRoot.Focus(FocusState.Programmatic);
6365
var expander = this.FindName("DefaultVHDSizeExpander") as SettingsExpander;
6466
var textBox = this.FindName("DefaultVHDSizeTextBox") as TextBox;
6567

src/windows/wslsettings/Views/Settings/MemAndProcPage.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
xmlns:behaviors="using:WslSettings.Behaviors"
77
behaviors:NavigationViewHeaderBehavior.HeaderMode="Never">
88

9-
<Grid Margin="{ThemeResource ContentPageMargin}">
9+
<Grid Margin="{ThemeResource ContentPageMargin}"
10+
IsTabStop="True"
11+
AutomationProperties.LandmarkType="Main"
12+
x:Name="MemAndProcPageRoot">
1013
<Grid.RowDefinitions>
1114
<RowDefinition Height="Auto" />
1215
<RowDefinition Height="Auto" />
1316
<RowDefinition Height="*" />
1417
</Grid.RowDefinitions>
15-
<TextBlock x:Uid="Settings_MemAndProcPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left"/>
18+
<TextBlock x:Uid="Settings_MemAndProcPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left" AutomationProperties.HeadingLevel="Level1"/>
1619
<TextBlock x:Uid="Settings_ErrorTryAgainLater" x:Name="Settings_ErrorTryAgainLater" Grid.Row="1" HorizontalAlignment="Left" AutomationProperties.LiveSetting="Assertive"
1720
Visibility="{x:Bind ViewModel.ErrorVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}"/>
1821
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto"

src/windows/wslsettings/Views/Settings/MemAndProcPage.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public MemAndProcPage()
3333

3434
private void OnPageLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
3535
{
36+
MemAndProcPageRoot.Focus(FocusState.Programmatic);
3637
RuntimeHelper.SetupExpanderFocusManagementByName(this, "ProcCountExpander", "ProcCountTextBox");
3738
RuntimeHelper.SetupExpanderFocusManagementByName(this, "MemorySizeExpander", "MemorySizeTextBox");
3839
RuntimeHelper.SetupExpanderFocusManagementByName(this, "SwapSizeExpander", "SwapSizeTextBox");

src/windows/wslsettings/Views/Settings/NetworkingPage.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
xmlns:behaviors="using:WslSettings.Behaviors"
77
behaviors:NavigationViewHeaderBehavior.HeaderMode="Never">
88

9-
<Grid Margin="{ThemeResource ContentPageMargin}">
9+
<Grid Margin="{ThemeResource ContentPageMargin}"
10+
IsTabStop="True"
11+
AutomationProperties.LandmarkType="Main"
12+
x:Name="NetworkingPageRoot">
1013
<Grid.RowDefinitions>
1114
<RowDefinition Height="Auto" />
1215
<RowDefinition Height="Auto" />
1316
<RowDefinition Height="*" />
1417
</Grid.RowDefinitions>
15-
<TextBlock x:Uid="Settings_NetworkingPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left"/>
18+
<TextBlock x:Uid="Settings_NetworkingPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left" AutomationProperties.HeadingLevel="Level1"/>
1619
<TextBlock x:Uid="Settings_ErrorTryAgainLater" x:Name="Settings_ErrorTryAgainLater" Grid.Row="1" HorizontalAlignment="Left" AutomationProperties.LiveSetting="Assertive"
1720
Visibility="{x:Bind ViewModel.ErrorVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}"/>
1821
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto"

src/windows/wslsettings/Views/Settings/NetworkingPage.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (C) Microsoft Corporation. All rights reserved.
22

3+
using Microsoft.UI.Xaml;
34
using Microsoft.UI.Xaml.Automation.Peers;
45
using Microsoft.UI.Xaml.Controls;
56
using Microsoft.UI.Xaml.Navigation;
@@ -32,6 +33,7 @@ public NetworkingPage()
3233

3334
private void OnPageLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
3435
{
36+
NetworkingPageRoot.Focus(FocusState.Programmatic);
3537
RuntimeHelper.SetupExpanderFocusManagementByName(this, "IgnoredPortsExpander", "IgnoredPortsTextBox");
3638
RuntimeHelper.SetupExpanderFocusManagementByName(this, "InitialAutoProxyTimeoutExpander", "InitialAutoProxyTimeoutTextBox");
3739
}

src/windows/wslsettings/Views/Settings/OptionalFeaturesPage.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
xmlns:controls="using:WslSettings.Controls"
88
behaviors:NavigationViewHeaderBehavior.HeaderMode="Never">
99

10-
<Grid Margin="{ThemeResource ContentPageMargin}">
10+
<Grid Margin="{ThemeResource ContentPageMargin}"
11+
IsTabStop="True"
12+
AutomationProperties.LandmarkType="Main"
13+
x:Name="OptionalFeaturesPageRoot">
1114
<Grid.RowDefinitions>
1215
<RowDefinition Height="Auto" />
1316
<RowDefinition Height="Auto" />
1417
<RowDefinition Height="*" />
1518
</Grid.RowDefinitions>
16-
<TextBlock x:Uid="Settings_OptionalFeaturesPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left"/>
19+
<TextBlock x:Uid="Settings_OptionalFeaturesPageTitle" Style="{ThemeResource PageHeaderTextBlockStyle}" Margin="{StaticResource MediumSmallBottomMargin}" HorizontalAlignment="Left" AutomationProperties.HeadingLevel="Level1"/>
1720
<TextBlock x:Uid="Settings_ErrorTryAgainLater" x:Name="Settings_ErrorTryAgainLater" Grid.Row="1" HorizontalAlignment="Left" AutomationProperties.LiveSetting="Assertive"
1821
Visibility="{x:Bind ViewModel.ErrorVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityConverter}}"/>
1922
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto"

src/windows/wslsettings/Views/Settings/OptionalFeaturesPage.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (C) Microsoft Corporation. All rights reserved.
22

3+
using Microsoft.UI.Xaml;
34
using Microsoft.UI.Xaml.Automation.Peers;
45
using Microsoft.UI.Xaml.Controls;
56
using Microsoft.UI.Xaml.Navigation;
@@ -32,6 +33,7 @@ public OptionalFeaturesPage()
3233

3334
private void OnPageLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
3435
{
36+
OptionalFeaturesPageRoot.Focus(FocusState.Programmatic);
3537
RuntimeHelper.SetupExpanderFocusManagementByName(this, "SystemdSettingsExpander", "InitTextBox");
3638
RuntimeHelper.SetupExpanderFocusManagementByName(this, "VMIdleTimeoutExpander", "VMIdleTimeoutTextBox");
3739
}

0 commit comments

Comments
 (0)