material-components / material-components/material-components-android

[Slider] Add new attributes for better accessibility support

Open
#2,773 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request Good First Issue Issue: Accessibility Widget: Slider
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

Slider does not provide enough configuration parameters for:

  1. Increment / decrement step value configuration for a11y mode - it's hardcoded to 20 percents
    https://github.com/material-components/material-components-android/blob/3fdfb6e230767138849edf858c13da1bf1d3f90b/lib/java/com/google/android/material/slider/BaseSlider.java#L2491

private float calculateStepIncrement(int stepFactor)

  1. There is no VoiceOver response on the value change event. We need to add annonceForAccessibility method call while the slider value is changed after some user interaction.

Solution:

  1. Add the following attributes:

accessibilityStepValue - should be used to determine a step, for which the value of the slider should be changed while the user performs AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD or AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD actions:

https://github.com/material-components/material-components-android/blob/3fdfb6e230767138849edf858c13da1bf1d3f90b/lib/java/com/google/android/material/slider/BaseSlider.java#L2491

private float calculateStepIncrement(int stepFactor)


Those parameters could be used for a proper a11y message creation - e.g.

annonceForAccessibility("Volume value incremented to 65 percent")
annonceForAccessibility("Temperature value decremented to 45 degrees")

Where "Volume", "Temperature" is accessibilityParameterName

And "percent", "degrees" is accessibilityUnitName

Describe alternatives you've considered
There are no alternatives for a slider step value configuration while we a dealing with a continuous slider, not the range slider.

Also, there is no message from a TalkBack when the user changes the slider value with swipe up or down.

In order to get the current slider value after a swipe user needs to perform one more tap - in order to force TalkBack to announce the updated slider value.

Additional context
This feature will simplify slider interaction for people with visual disabilities and will provide a much simpler API for Android Apps developers.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/java/com/google/android/material/slider/BaseSlider.java, especially calculateStepIncrement(int stepFactor) and the accessibility action handling referenced in the issue. Trace how slider attributes are declared and how value changes are processed. Done means the three attributes configure accessibility steps and announcements include the parameter, action, value, and unit as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
accessibility, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.