[Fancy Zones] Fixed accessibility text of monitors on Layout Editor (#36997)

Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
This commit is contained in:
Ani
2025-02-20 10:40:26 +01:00
committed by GitHub
parent 9453e38881
commit c6f9701818
5 changed files with 50 additions and 8 deletions

View File

@@ -83,9 +83,7 @@
<Border <Border
x:Name="MonitorItem" x:Name="MonitorItem"
Width="{Binding DisplayWidth}" Width="{Binding DisplayWidth}"
Height="{Binding DisplayHeight}" Height="{Binding DisplayHeight}">
AutomationProperties.HelpText="{Binding Index}"
AutomationProperties.Name="{x:Static props:Resources.Monitor}">
<Border.ToolTip> <Border.ToolTip>
<ToolTip> <ToolTip>
<StackPanel> <StackPanel>

View File

@@ -5,7 +5,9 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Globalization; using System.Globalization;
using System.Text;
using FancyZonesEditor.Properties;
using FancyZonesEditor.ViewModels; using FancyZonesEditor.ViewModels;
namespace FancyZonesEditor.Utils namespace FancyZonesEditor.Utils
@@ -14,6 +16,8 @@ namespace FancyZonesEditor.Utils
{ {
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
private static readonly CompositeFormat MonitorIndexFormat = CompositeFormat.Parse(Resources.Monitor_Index);
public MonitorInfoModel(int index, int height, int width, int dpi, bool selected = false) public MonitorInfoModel(int index, int height, int width, int dpi, bool selected = false)
{ {
Index = index; Index = index;
@@ -24,6 +28,10 @@ namespace FancyZonesEditor.Utils
Selected = selected; Selected = selected;
} }
public string AccessibleName => string.Format(CultureInfo.CurrentCulture, MonitorIndexFormat, Index);
public string AccessibleHelpText => $"{Resources.Dimensions} {Dimensions}, {Resources.Scaling} {Scaling}";
public int Index { get; set; } public int Index { get; set; }
public int ScreenBoundsHeight { get; set; } public int ScreenBoundsHeight { get; set; }

View File

@@ -276,6 +276,15 @@ namespace FancyZonesEditor.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Dimensions.
/// </summary>
public static string Dimensions {
get {
return ResourceManager.GetString("Dimensions", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Highlight distance. /// Looks up a localized string similar to Highlight distance.
/// </summary> /// </summary>
@@ -539,7 +548,7 @@ namespace FancyZonesEditor.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to /// Looks up a localized string similar to
///• [Shift]+S to split currently focused zone. ///• Shift+S to split currently focused zone.
///• Ctrl+Tab to focus zones/resizers. ///• Ctrl+Tab to focus zones/resizers.
///• Tab to cycle zones and resizers. ///• Tab to cycle zones and resizers.
///• Delete to remove the focused resizer. ///• Delete to remove the focused resizer.
@@ -554,8 +563,8 @@ namespace FancyZonesEditor.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to /// Looks up a localized string similar to
///• Ctrl+Tab to switch focus between dialog and zones. ///• Ctrl+Tab to switch focus between dialog and zones.
///• [Shift]+Arrows to resize the focused zone by 10px (5px per edge). ///• Shift+Arrows to resize the focused zone by 10px (5px per edge).
///• Ctrl+[Shift]+Arrows to resize the focused zone by 2px (1px per edge). ///• Ctrl+Shift+Arrows to resize the focused zone by 2px (1px per edge).
///• Arrows to move the focused zone by 10px. ///• Arrows to move the focused zone by 10px.
///• Ctrl+Arrows to move the focused zone by 1px.. ///• Ctrl+Arrows to move the focused zone by 1px..
/// </summary> /// </summary>
@@ -655,6 +664,15 @@ namespace FancyZonesEditor.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Monitor {0}.
/// </summary>
public static string Monitor_Index {
get {
return ResourceManager.GetString("Monitor_Index", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Name. /// Looks up a localized string similar to Name.
/// </summary> /// </summary>
@@ -790,6 +808,15 @@ namespace FancyZonesEditor.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Scaling.
/// </summary>
public static string Scaling {
get {
return ResourceManager.GetString("Scaling", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Set layout as a default for horizontal monitor orientation. /// Looks up a localized string similar to Set layout as a default for horizontal monitor orientation.
/// </summary> /// </summary>

View File

@@ -282,6 +282,15 @@
<data name="Monitor" xml:space="preserve"> <data name="Monitor" xml:space="preserve">
<value>Monitor</value> <value>Monitor</value>
</data> </data>
<data name="Monitor_Index" xml:space="preserve">
<value>Monitor {0}</value>
</data>
<data name="Dimensions" xml:space="preserve">
<value>Dimensions</value>
</data>
<data name="Scaling" xml:space="preserve">
<value>Scaling</value>
</data>
<data name="Settings" xml:space="preserve"> <data name="Settings" xml:space="preserve">
<value>Template settings</value> <value>Template settings</value>
</data> </data>

View File

@@ -26,11 +26,11 @@
<Style x:Key="MonitorItemContainerStyle" TargetType="ui:GridViewItem"> <Style x:Key="MonitorItemContainerStyle" TargetType="ui:GridViewItem">
<Setter Property="Background" Value="{DynamicResource LayoutItemBackgroundBrush}" /> <Setter Property="Background" Value="{DynamicResource LayoutItemBackgroundBrush}" />
<Setter Property="IsSelected" Value="{Binding Selected, Mode=OneWay}" /> <Setter Property="IsSelected" Value="{Binding Selected, Mode=OneWay}" />
<Setter Property="AutomationProperties.Name" Value="{Binding Index}" /> <Setter Property="AutomationProperties.Name" Value="{Binding AccessibleName}" />
<Setter Property="AutomationProperties.HelpText" Value="{Binding AccessibleHelpText}" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local" /> <Setter Property="KeyboardNavigation.TabNavigation" Value="Local" />
<Setter Property="MinWidth" Value="0" /> <Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="0" /> <Setter Property="MinHeight" Value="0" />
<!--<Setter Property="IsHoldingEnabled" Value="True" />-->
<Setter Property="CornerRadius" Value="4" /> <Setter Property="CornerRadius" Value="4" />
<Setter Property="Margin" Value="8" /> <Setter Property="Margin" Value="8" />
<Setter Property="UseSystemFocusVisuals" Value="{DynamicResource UseSystemFocusVisuals}" /> <Setter Property="UseSystemFocusVisuals" Value="{DynamicResource UseSystemFocusVisuals}" />