Skip to content

Commit bb08fa7

Browse files
authored
fix(material-experimental/mdc-chips): chip removal not working if animations are disabled (#18314)
MDC waits for a `transitionend` event to fire before it emits the chip removal event, but if animations are disabled the event won't fire. These changes switch to using a very short transition instead. Fixes #18303.
1 parent bbb92a7 commit bb08fa7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
@import '@material/chips/mixins.import';
22
@import '../../material/core/style/layout-common';
3-
@import '../../material/core/style/noop-animation';
43
@import '../../cdk/a11y/a11y';
54
@import '../mdc-helpers/mdc-helpers';
65

76
@include mdc-chip-without-ripple($query: $mat-base-styles-query);
87
@include mdc-chip-set-core-styles($query: $mat-base-styles-query);
9-
@include _noop-animation;
108

119
.mat-mdc-chip {
1210
// MDC uses a pointer cursor
@@ -16,6 +14,14 @@
1614
// Required for the ripple to clip properly in Safari.
1715
transform: translateZ(0);
1816

17+
&._mat-animation-noopable {
18+
// MDC's chip removal works by toggling a class on the chip, waiting for its transitions
19+
// to finish and emitting the remove event at the end. The problem is that if our animations
20+
// were disabled via the `NoopAnimationsModule`, the element won't have a transition and
21+
// `transitionend` won't fire. We work around the issue by assigning a very short transition.
22+
transition-duration: 1ms;
23+
}
24+
1925
@include cdk-high-contrast {
2026
outline: solid 1px;
2127

0 commit comments

Comments
 (0)