fix: NVDA reads the tree entry, slider and help button under the mouse

The tree entry listed the entries under it as its own children, so the controls
inside it lost their way up and Windows failed every lookup there. It now only
points up to the entry it hangs under, which is all the level needs.

The buttons and knob of a slider's track had no name; they now say the slider's
name and value. A button showing only a sign such as "?" takes its tooltip.
This commit is contained in:
maj00r
2026-11-15 19:07:20 +01:00
parent edd530cb4b
commit 95f1cd2398
6 changed files with 75 additions and 22 deletions

View File

@@ -158,8 +158,11 @@ public static class ScreenReaderNames
AutomationProperties.SetAccessibilityView(panel, name is null ? AccessibilityView.Default : AccessibilityView.Content);
}
// A sign such as "?" says nothing read aloud; its tooltip says what it does.
private static void NameButton(Button button) =>
Give(button, button.Content is string ? null : TextOf(ToolTip.GetTip(button)) ?? TextOf(button.Content));
Give(button, button.Content is string text && text.Any(char.IsLetterOrDigit)
? null
: TextOf(ToolTip.GetTip(button)) ?? TextOf(button.Content));
// The descriptions given here, so a later one replaces it but nothing else.
private static readonly ConditionalWeakTable<StyledElement, string> Described = new();