Forum Xamarin.Forms

Can anybody share custom Slider renderers that have screen readers report current value?

JohnHardmanJohnHardman GBUniversity admin

When using screen readers with Xamarin.Forms Sliders, the screen reader reports the position of the Slider as a percentage rather than reporting the current value of the Slider. This feels like something that others will already have addressed, probably using custom renderers (e.g. on iOS by overriding accessibilityValue). Rather than re-invent the wheel, I was wondering if anybody who has already addressed this would be willing to share the code that they used?

Answers

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    the screen reader reports the position of the Slider as a percentage rather than reporting the current value of the Slider

    For this requirement, you could detect ValueChanged event of the Slider to get and report the value manaually.

    private void Slider_ValueChanged(object sender, ValueChangedEventArgs e)
    {
        //get and report the value
    }
    
  • JohnHardmanJohnHardman GBUniversity admin

    @Jarvan said:

    the screen reader reports the position of the Slider as a percentage rather than reporting the current value of the Slider

    For this requirement, you could detect ValueChanged event of the Slider to get and report the value manaually.

    private void Slider_ValueChanged(object sender, ValueChangedEventArgs e)
    {
        //get and report the value
    }
    

    The desired result is that the value is reported, not the percentage and the value.

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    Here is a wordaround about the function: using a Label to display the slider's value, then report the label's text only.

    Related link:
    https://stackoverflow.com/questions/41541706/android-talkback-for-seekbar-values

  • JohnHardmanJohnHardman GBUniversity admin

    @Jarvan said:
    Here is a wordaround about the function: using a Label to display the slider's value, then report the label's text only.

    Related link:
    https://stackoverflow.com/questions/41541706/android-talkback-for-seekbar-values

    I've done the equivalent of that already, but doing so results in additional "noise" for those making use of the accessibility options on devices. I want to get rid of that and have the Sliders report useful information, so that those using accessibility options do not have to put up with a lesser user experience. Unfortunately, XF AutomationProperties are inadequate currently. For example, on iOS, they do not provide a mechanism for using AccessibilityValue. It's AccessibilityValue that needs to be handled on iOS when reporting values, and for the scenario that this thread is about it's a renderer that updates AccessibilityValue that is required. I was hoping that somebody would have done this already.

    Currently, the XF API encourages developers (well, the few who actually attempt to support accessibility) to report values using AutomationProperties.NameProperty and/or AutomationProperties.HelpText, neither of which results in guidance being followed for iOS, and that result in the Accessibility User Interface being harder to use than the Visual User Interface. iOS in particular has brilliant accessibility support built-in. Unfortunately, XF support for it is limited and currently very buggy, to the extent that I can not currently recommend XF for developing apps intended to be inclusive.

  • YelinzhYelinzh Member, Xamarin Team Xamurai

    Sorry about that, you could report the request/issue to product team on github to improve the library.

  • JohnHardmanJohnHardman GBUniversity admin

    @Jarvan said:
    Sorry about that, you could report the request/issue to product team on github to improve the library.

    Done, at https://github.com/xamarin/Xamarin.Forms/issues/12889

Sign In or Register to comment.