Skip to content

Commit 79bd7d7

Browse files
kendrickumstattddrchen
authored andcommitted
[a11y][Chips] Add missing 'button' mention to Talkback output for close icon.
Recording, before: http://recall/-/hPu3uxWupaB3jE5JXfMuKd/cAF19QKQl7DNPiEUSh5nHq Recording, after: http://recall/-/hPu3uxWupaB3jE5JXfMuKd/crZJ8t5wC4xppg19MTmHDE PiperOrigin-RevId: 726017137
1 parent 7c10afc commit 79bd7d7

File tree

1 file changed

+3
-0
lines changed
  • lib/java/com/google/android/material/chip

1 file changed

+3
-0
lines changed

lib/java/com/google/android/material/chip/Chip.java

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import android.view.ViewParent;
5555
import android.view.accessibility.AccessibilityEvent;
5656
import android.view.accessibility.AccessibilityNodeInfo;
57+
import android.widget.Button;
5758
import android.widget.CompoundButton;
5859
import androidx.annotation.AnimatorRes;
5960
import androidx.annotation.BoolRes;
@@ -1010,6 +1011,8 @@ protected void onPopulateNodeForVirtualView(
10101011
node.setBoundsInParent(getCloseIconTouchBoundsInt());
10111012
node.addAction(AccessibilityActionCompat.ACTION_CLICK);
10121013
node.setEnabled(isEnabled());
1014+
// Set the class name to Button so that the close icon is treated as a button by TalkBack.
1015+
node.setClassName(Button.class.getName());
10131016
} else {
10141017
node.setContentDescription("");
10151018
node.setBoundsInParent(EMPTY_BOUNDS);

0 commit comments

Comments
 (0)