Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,15 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
result.addAction(AccessibilityNodeInfo.ACTION_CLICK);
result.setClickable(true);
}
} else {
// Prevent Slider to receive a regular tap which will change the value.
//
// This is needed because it causes slider to select to middle if it
// doesn't have a semantics tap.
if (semanticsNode.hasFlag(Flag.IS_SLIDER)) {
result.addAction(AccessibilityNodeInfo.ACTION_CLICK);
result.setClickable(true);
}
}
if (semanticsNode.hasAction(Action.LONG_PRESS)) {
if (semanticsNode.onLongPressOverride != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2165,6 +2165,21 @@ public void SetSourceAndPackageNameForAccessibilityEvent() {
verify(mockEvent).setSource(eq(mockRootView), eq(123));
}

@Test
public void itAddsClickActionToSliderNodeInfo() {
AccessibilityBridge accessibilityBridge = setUpBridge();

TestSemanticsNode testSemanticsNode = new TestSemanticsNode();
testSemanticsNode.addFlag(AccessibilityBridge.Flag.IS_SLIDER);
TestSemanticsUpdate testSemanticsUpdate = testSemanticsNode.toUpdate();
testSemanticsUpdate.sendUpdateToBridge(accessibilityBridge);
AccessibilityNodeInfo nodeInfo = accessibilityBridge.createAccessibilityNodeInfo(0);

assertEquals(nodeInfo.isClickable(), true);
List<AccessibilityNodeInfo.AccessibilityAction> actions = nodeInfo.getActionList();
assertTrue(actions.contains(AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK));
}

AccessibilityBridge setUpBridge() {
return setUpBridge(null, null, null, null, null, null);
}
Expand Down