fix: nothing under the mouse is silent: dividers, previews, class pictures, categories

A page swept point by point left a few places a reader heard nothing: the panel
dividers, the vehicle preview in the depot and the texture base, the picture by
a vehicle class and the empty part of the settings categories. Each now has a
name; a picture with a caption beside it reads as the caption.

The tests that build controls run one after another: a control belongs to the
thread that made the first one, and side by side they now and then failed.
This commit is contained in:
maj00r
2026-11-15 20:01:25 +01:00
parent 184629b544
commit ee6da4c8ee
19 changed files with 65 additions and 7 deletions

View File

@@ -166,7 +166,7 @@ public static class ScreenReaderNames
private const int PictureReach = 3;
/// <summary>
/// Names a picture after the button or card it lies in. Under the mouse a reader
/// Names a picture after the caption beside it or the button or card it lies in. Under the mouse a reader
/// hears what lies there, and a bare picture said nothing: a vehicle in the consist,
/// the logo, an icon on a button.
/// </summary>
@@ -176,6 +176,14 @@ public static class ScreenReaderNames
|| AutomationProperties.GetLabeledBy(picture) is not null)
return;
// A caption beside it says what it shows, such as a vehicle class by its picture.
if (picture.Parent is Panel row
&& row.Children.OfType<TextBlock>().FirstOrDefault(t => t.IsVisible && !string.IsNullOrWhiteSpace(t.Text)) is { } caption)
{
AutomationProperties.SetLabeledBy(picture, caption);
return;
}
var holder = picture.Parent as Control;
for (int i = 0; i < PictureReach && holder is not null; i++, holder = holder.Parent as Control)
{