[FancyZones Editor][Accessibility] Default focused elements in all FancyZones Editor windows (#7971)

* Default focused elements

* Fix focus when starting editor from settings
This commit is contained in:
stefansjfw 2020-11-12 10:08:17 +01:00 committed by GitHub
parent 6a580c720a
commit 102f42928c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 5 deletions

View File

@ -176,7 +176,7 @@
</Style> </Style>
</Window.Resources> </Window.Resources>
<StackPanel> <StackPanel FocusManager.FocusedElement="{Binding ElementName=newZoneButton}">
<TextBlock Name="windowEditorDialogTitle" Text="{x:Static props:Resources.Custom_Layout_Creator}" Style="{StaticResource titleText}" /> <TextBlock Name="windowEditorDialogTitle" Text="{x:Static props:Resources.Custom_Layout_Creator}" Style="{StaticResource titleText}" />
<Button x:Name="newZoneButton" AutomationProperties.LabeledBy="{Binding ElementName=newZoneName}" Width="496" Height="136" Style="{StaticResource newZoneButton}" Click="OnAddZone"> <Button x:Name="newZoneButton" AutomationProperties.LabeledBy="{Binding ElementName=newZoneName}" Width="496" Height="136" Style="{StaticResource newZoneButton}" Click="OnAddZone">
<StackPanel> <StackPanel>

View File

@ -179,7 +179,7 @@
<TextBlock Text="{x:Static props:Resources.Note_Custom_Table}" Style="{StaticResource textLabel}" TextWrapping="Wrap" /> <TextBlock Text="{x:Static props:Resources.Note_Custom_Table}" Style="{StaticResource textLabel}" TextWrapping="Wrap" />
<TextBlock x:Name="customLayoutName" Text="{x:Static props:Resources.Name}" Style="{StaticResource textLabel}" /> <TextBlock x:Name="customLayoutName" Text="{x:Static props:Resources.Name}" Style="{StaticResource textLabel}" />
<TextBox Text="{Binding Name}" AutomationProperties.LabeledBy="{Binding ElementName=customLayoutName}" Style="{StaticResource textBox}" /> <TextBox Name="customLayoutNameTextBox" Text="{Binding Name}" GotFocus="NameTextBox_GotFocus" AutomationProperties.LabeledBy="{Binding ElementName=customLayoutName}" Style="{StaticResource textBox}" />
<!-- <!--
<StackPanel Orientation="Horizontal" Margin="0,8,0,0"> <StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<CheckBox x:Name="showGridSetting" VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="True" Margin="21,4,0,0"/> <CheckBox x:Name="showGridSetting" VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="True" Margin="21,4,0,0"/>

View File

@ -38,5 +38,15 @@ namespace FancyZonesEditor
} }
private GridLayoutModel _stashedModel; private GridLayoutModel _stashedModel;
private void NameTextBox_GotFocus(object sender, RoutedEventArgs e)
{
customLayoutNameTextBox.CaretIndex = customLayoutNameTextBox.Text.Length;
}
public System.Windows.Controls.TextBox NameTextBox()
{
return customLayoutNameTextBox;
}
} }
} }

View File

@ -188,7 +188,7 @@
</ControlTemplate> </ControlTemplate>
</Window.Resources> </Window.Resources>
<StackPanel> <StackPanel FocusManager.FocusedElement="{Binding ElementName=decrementZones}">
<TextBlock Name="DialogTitle" Text="{x:Static props:Resources.Choose_Layout}" Style="{StaticResource titleText}" /> <TextBlock Name="DialogTitle" Text="{x:Static props:Resources.Choose_Layout}" Style="{StaticResource titleText}" />

View File

@ -154,9 +154,11 @@ namespace FancyZonesEditor
mainEditor.Edit(); mainEditor.Edit();
EditorWindow window; EditorWindow window;
bool isGrid = false;
if (model is GridLayoutModel) if (model is GridLayoutModel)
{ {
window = new GridEditorWindow(); window = new GridEditorWindow();
isGrid = true;
} }
else else
{ {
@ -166,6 +168,10 @@ namespace FancyZonesEditor
window.Owner = EditorOverlay.Current; window.Owner = EditorOverlay.Current;
window.DataContext = model; window.DataContext = model;
window.Show(); window.Show();
if (isGrid)
{
(window as GridEditorWindow).NameTextBox().Focus();
}
} }
private void Apply_Click(object sender, RoutedEventArgs e) private void Apply_Click(object sender, RoutedEventArgs e)

View File

@ -724,7 +724,7 @@ void FancyZones::ToggleEditor() noexcept
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI }; sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };
sei.lpFile = NonLocalizable::FZEditorExecutablePath; sei.lpFile = NonLocalizable::FZEditorExecutablePath;
sei.lpParameters = params.c_str(); sei.lpParameters = params.c_str();
sei.nShow = SW_SHOWNORMAL; sei.nShow = SW_SHOWDEFAULT;
ShellExecuteEx(&sei); ShellExecuteEx(&sei);
Trace::FancyZones::EditorLaunched(1); Trace::FancyZones::EditorLaunched(1);