material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.42k stars 3.08k forks source link

[Slider] Accessibility content description for virtual view subtree #2176

Open jaredrummler opened 3 years ago

jaredrummler commented 3 years ago

When Explore by Touch is enabled (Google TalkBack), the slider announces the value and not the label associated with the value, causing confusion to users who rely on accessibility features.

Describe the solution you'd like The BaseSlider.AccessibilityHelper is a private class and, as far as I can tell, the content description for the virtual views can not be overridden. It would be useful to set the content description for each slider step/value. Currently, TalkBack announces the following text when focused on a virtual view on the slider:

"0%, Slider, Use volume keys to adjust"

It would be more useful to replace the percentage with the associated label for each value:

"[Label at 0%], Slider, Use volume keys to adjust"

Adding an AccessibilityDelegate is not an option as the Slider view has its own private implementation which is not accessible to consumers of the library. It would be helpful to make this public so a custom implementation of an AccessibilityDelegate would be possible or adding a method to set the content description for each virtual view.

ymarian commented 3 years ago

Hi I think makes sense, thanks for the suggestion