mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-27 17:09:37 +01:00
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:
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user