Skip to content

Commit 90456b0

Browse files
committed
fix(material/dialog): scale animation not working (#28449)
[A change in MDC](material-components/material-components-web@d153db6) moved the `transform` animation from the container to the surface which broke our implementation. These changes also take the chance to fix that the animation was targeting all properties, rather than just `transform` and `opacity`. I've also fixed up the demo a bit to make it less jumpy. Fixes #28447. (cherry picked from commit 7f1562d)
1 parent 9e7fe24 commit 90456b0

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/dev-app/dialog/dialog-demo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,24 +195,24 @@ export class JazzDialog {
195195
`
196196
img {
197197
max-width: 100%;
198+
height: 800px;
198199
}
199200
`,
200201
],
201202
template: `
202203
<h2 mat-dialog-title>Neptune</h2>
203204
204205
<mat-dialog-content>
205-
<img src="https://upload.wikimedia.org/wikipedia/commons/5/56/Neptune_Full.jpg"/>
206-
207206
<p>
208207
Neptune is the eighth and farthest known planet from the Sun in the Solar System. In the
209208
Solar System, it is the fourth-largest planet by diameter, the third-most-massive planet,
210209
and the densest giant planet. Neptune is 17 times the mass of Earth and is slightly more
211210
massive than its near-twin Uranus, which is 15 times the mass of Earth and slightly larger
212211
than Neptune. Neptune orbits the Sun once every 164.8 years at an average distance of 30.1
213-
astronomical units (4.50×109 km). It is named after the Roman god of the sea and has the
212+
astronomical units (4.50x109 km). It is named after the Roman god of the sea and has the
214213
astronomical symbol ♆, a stylised version of the god Neptune's trident.
215214
</p>
215+
<img src="https://upload.wikimedia.org/wikipedia/commons/5/56/Neptune_Full.jpg"/>
216216
</mat-dialog-content>
217217
218218
<mat-dialog-actions [align]="actionsAlignment">

src/material/dialog/dialog.scss

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use '@material/dialog' as mdc-dialog;
2+
@use '@material/animation/animation' as mdc-animation;
23
@use '@material/dialog/dialog-theme' as mdc-dialog-theme;
34
@use '../core/tokens/m2/mdc/dialog' as tokens-mdc-dialog;
45
@use '../core/mdc-helpers/mdc-helpers';
@@ -33,14 +34,20 @@ $mat-dialog-button-horizontal-margin: 8px !default;
3334
outline: 0;
3435

3536
.mdc-dialog__container {
36-
transition-duration: var(--mat-dialog-transition-duration, 0ms);
37+
transition: opacity linear var(--mat-dialog-transition-duration, 0ms);
38+
}
39+
40+
.mdc-dialog__surface {
41+
transition: mdc-animation.enter(transform, var(--mat-dialog-transition-duration, 0ms));
3742
}
3843

3944
// Angular Material supports disabling all animations when NoopAnimationsModule is imported.
4045
// TODO(devversion): Look into using MDC's Sass queries to separate the animation styles and
4146
// conditionally add them. Consider the size cost and churn when deciding whether to switch.
42-
&._mat-animation-noopable .mdc-dialog__container {
43-
transition: none;
47+
&._mat-animation-noopable {
48+
.mdc-dialog__container, .mdc-dialog__surface {
49+
transition: none;
50+
}
4451
}
4552
}
4653
}

0 commit comments

Comments
 (0)