Skip to content

Commit 502c04f

Browse files
committed
fix(material-experimental/mdc-chips): use ripple target for state interactions
1 parent 320f387 commit 502c04f

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

src/material-experimental/mdc-chips/chip-option.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<span class="mdc-chip__ripple"></span>
12
<ng-content select="mat-chip-avatar, [matChipAvatar]"></ng-content>
23
<svg *ngIf="_chipListMultiple" class="mdc-chip__checkmark-svg" viewBox="-2 -3 30 30">
34
<path class="mdc-chip__checkmark-path" fill="none" stroke="black"

src/material-experimental/mdc-chips/chip-row.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div role="gridcell">
22
<div #chipContent tabindex="-1" class="mat-chip-row-focusable-text-content">
3+
<span class="mdc-chip__ripple"></span>
34
<ng-content select="mat-chip-avatar, [matChipAvatar]"></ng-content>
45
<span class="mdc-chip__text"><ng-content></ng-content></span>
56
<ng-content select="mat-chip-trailing-icon,[matChipTrailingIcon]"></ng-content>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<span class="mdc-chip__ripple"></span>
12
<ng-content select="mat-chip-avatar, [matChipAvatar]"></ng-content>
23
<div class="mdc-chip__text mdc-chip__action--primary"><ng-content></ng-content></div>
34
<ng-content select="mat-chip-trailing-icon,[matChipRemove],[matChipTrailingIcon]"></ng-content>

src/material-experimental/mdc-chips/chips.scss

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import '@material/chips/mixins';
2+
@import '../../material/core/style/layout-common';
23
@import '../../material/core/style/noop-animation';
34
@import '../../cdk/a11y/a11y';
45
@import '../mdc-helpers/mdc-helpers';
@@ -28,22 +29,14 @@
2829
// The MDC chip styles related to hover and focus states are intertwined with the MDC ripple styles.
2930
// We currently don't use the MDC ripple due to size concerns, therefore we need to add some
3031
// additional styles to restore these states.
31-
.mat-mdc-chip:not(.mat-mdc-chip-disabled) {
32-
&:hover, &:focus, div:focus {
33-
.mdc-chip__text::after {
34-
content: '';
35-
position: absolute;
36-
width: 100%;
37-
height: 100%;
32+
.mdc-chip__ripple {
33+
@include mdc-ripple-target-common($query: structure);
3834

39-
// Note that we use a `background` and `opacity`, instead of an `rgba` background, because
40-
// `rgba` backgrounds get converted into solid colors in high contrast mode.
41-
background: #000;
42-
opacity: 0.2;
43-
top: 0;
44-
left: 0;
45-
pointer-events: none;
46-
}
35+
&::after, &::before {
36+
@include mat-fill;
37+
content: '';
38+
pointer-events: none;
39+
opacity: 0;
4740
}
4841
}
4942

@@ -55,6 +48,11 @@
5548
.mat-mdc-chip-trailing-icon, .mat-chip-row-focusable-text-content {
5649
pointer-events: none;
5750
}
51+
52+
// Do not show state interactions for disabled chips.
53+
.mdc-chip__ripple::after, .mdc-chip__ripple::before {
54+
display: none;
55+
}
5856
}
5957

6058
// Angular Material supports vertically-stacked chips, which MDC does not.

0 commit comments

Comments
 (0)