material-components / material-components/material-components-android
[RangeSlider] Thumbs are not accessible to UiAutomator2
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
Description: The thumbs of the RangeSlider are no longer accessible in the view tree used by UiAutomator2
Expected behavior: The thumbs should appear in the view tree available to UiAutomator2 so that automated tests can continue to manipulate sliders.
Source code:
I narrowed it down to the changes in https://github.com/material-components/material-components-android/commit/ab52e6afc4a80c3adc9536a58831fe7883667871
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
// Setting visible to user to false prevents duplicate announcements by making only our virtual
// view accessible, not the parent container.
info.setVisibleToUser(false);
}
Android API version: N/A
Material Library version: 1.13.0
Device: Pixel 8 Pro
Workaround:
We can create our own RangeSlider and override onInitializeAccessibilityNodeInfo to info.setVisibleToUser(true).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing commit ab52e6afc4a80c3adc9536a58831fe7883667871 and locating RangeSlider's onInitializeAccessibilityNodeInfo implementation. Reproduce the UiAutomator2 view-tree behavior, then add or update coverage for the thumbs. Done means RangeSlider thumbs appear in the UiAutomator2 tree and remain usable for automated slider manipulation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- accessibility, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100