Skip to content

Deleting an mdc chip does not work when animations are disabled #18303

Closed
@atscott

Description

@atscott

MDC chip foundation relies on the transition animation for the exit class for processing chip deletion:
https://github.com/material-components/material-components-web/blob/302cfd02ace89acf74c90dd13e0a99afc6112fbc/packages/mdc-chips/chip/foundation.ts#L156

When using NoopAnimationModule transitions are disabled via the _mat-animation-noopable class:

'[class._mat-animation-noopable]': '_animationsDisabled',

This means that any application using the NoopAnimationModule (mostly tests) will not handle chip deletion correctly. This could be solved by having a special class that makes transition durations very short when a transition is required for the component to work correctly.

A harder to solve problem (and one that would need to be solved in MDC foundation itself) may be applications that disable transitions with a global css override like * { transition: none; }

One additional note: this issue was observed when using the mdc chips with Angular Ivy enabled. For some reason, the _mat-animation-noopable class isn't being added to the chip when View Engine is enabled (and I have not investigated why that is).

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions