[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>
</Window.Resources>
<StackPanel>
<StackPanel FocusManager.FocusedElement="{Binding ElementName=newZoneButton}">
<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">
<StackPanel>

View File

@ -179,7 +179,7 @@
<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}" />
<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">
<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 void NameTextBox_GotFocus(object sender, RoutedEventArgs e)
{
customLayoutNameTextBox.CaretIndex = customLayoutNameTextBox.Text.Length;
}
public System.Windows.Controls.TextBox NameTextBox()
{
return customLayoutNameTextBox;
}
}
}

View File

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

View File

@ -154,9 +154,11 @@ namespace FancyZonesEditor
mainEditor.Edit();
EditorWindow window;
bool isGrid = false;
if (model is GridLayoutModel)
{
window = new GridEditorWindow();
isGrid = true;
}
else
{
@ -166,6 +168,10 @@ namespace FancyZonesEditor
window.Owner = EditorOverlay.Current;
window.DataContext = model;
window.Show();
if (isGrid)
{
(window as GridEditorWindow).NameTextBox().Focus();
}
}
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.lpFile = NonLocalizable::FZEditorExecutablePath;
sei.lpParameters = params.c_str();
sei.nShow = SW_SHOWNORMAL;
sei.nShow = SW_SHOWDEFAULT;
ShellExecuteEx(&sei);
Trace::FancyZones::EditorLaunched(1);