Skip to content

Commit a7ff8c9

Browse files
committed
[Chip] Fix close icon focus ripple
PiperOrigin-RevId: 708446508
1 parent 59de693 commit a7ff8c9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,8 @@ protected void getVisibleVirtualViews(@NonNull List<Integer> virtualViewIds) {
985985
protected void onVirtualViewKeyboardFocusChanged(int virtualViewId, boolean hasFocus) {
986986
if (virtualViewId == CLOSE_ICON_VIRTUAL_ID) {
987987
closeIconFocused = hasFocus;
988+
}
989+
if (chipDrawable.refreshCloseIconFocus(closeIconFocused)) {
988990
refreshDrawableState();
989991
}
990992
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,14 @@ public void setTextColor(@Nullable ColorStateList color) {
13961396
}
13971397
}
13981398

1399+
boolean refreshCloseIconFocus(boolean closeIconFocused) {
1400+
boolean changed = false;
1401+
if (closeIcon != null) {
1402+
changed = setCloseIconState(closeIconFocused ? new int[] {android.R.attr.state_pressed, android.R.attr.state_enabled} : DEFAULT_STATE);
1403+
}
1404+
return changed;
1405+
}
1406+
13991407
/** Delegate interface to be implemented by Views that own a ChipDrawable. */
14001408
public interface Delegate {
14011409

0 commit comments

Comments
 (0)