fix: a screen reader reads a slider as the value shown beside it

NVDA read a slider's bare number as a share of its length, so -5 °C was 45 and
the fog was where the knob stood on its scale. Sliders now give the text shown
next to them: the weather's temperature and visibility, and every setting row.
This commit is contained in:
maj00r
2026-11-15 17:59:04 +01:00
parent 5883376762
commit a0a6ebdffa
8 changed files with 175 additions and 32 deletions

View File

@@ -95,6 +95,16 @@ public static class ScreenReaderNames
Give(input, label);
}
/// <summary>
/// The value a setting row shows, given to the slider in it, so the reader hears
/// "100%" or "Wyłączone" and not where the knob stands.
/// </summary>
public static void TellValue(object? content, string? valueText)
{
foreach (var slider in Inputs(content).OfType<ReadableSlider>())
slider.ValueText = valueText;
}
private static IEnumerable<Control> Inputs(object? content) => content switch
{
ComboBox or Slider or TextBox or NumericUpDown => new[] { (Control)content },