Skip to content

Commit 53242fe

Browse files
authored
fix(material/stepper): allow child animations to run (#27338)
Currently the stepper doesn't explicitly allow child animations to run which means that other componets like expansion panels may be blocked from animating their initial state. These changes add an `animateChild` query to the stepper to unblock the child animations. Fixes #27318.
1 parent 6d0d47e commit 53242fe

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/material/stepper/stepper-animations.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import {
1212
transition,
1313
trigger,
1414
AnimationTriggerMetadata,
15+
group,
16+
query,
17+
animateChild,
1518
} from '@angular/animations';
1619

1720
export const DEFAULT_HORIZONTAL_ANIMATION_DURATION = '500ms';
@@ -33,9 +36,16 @@ export const matStepperAnimations: {
3336
// making this element focusable inside of a `hidden` element.
3437
state('current', style({transform: 'none', visibility: 'inherit'})),
3538
state('next', style({transform: 'translate3d(100%, 0, 0)', visibility: 'hidden'})),
36-
transition('* => *', animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)'), {
37-
params: {'animationDuration': DEFAULT_HORIZONTAL_ANIMATION_DURATION},
38-
}),
39+
transition(
40+
'* => *',
41+
group([
42+
animate('{{animationDuration}} cubic-bezier(0.35, 0, 0.25, 1)'),
43+
query('@*', animateChild(), {optional: true}),
44+
]),
45+
{
46+
params: {'animationDuration': DEFAULT_HORIZONTAL_ANIMATION_DURATION},
47+
},
48+
),
3949
]),
4050

4151
/** Animation that transitions the step along the Y axis in a vertical stepper. */
@@ -46,8 +56,15 @@ export const matStepperAnimations: {
4656
// because visibility on a child element the one from the parent,
4757
// making this element focusable inside of a `hidden` element.
4858
state('current', style({height: '*', visibility: 'inherit'})),
49-
transition('* <=> current', animate('{{animationDuration}} cubic-bezier(0.4, 0.0, 0.2, 1)'), {
50-
params: {'animationDuration': DEFAULT_VERTICAL_ANIMATION_DURATION},
51-
}),
59+
transition(
60+
'* <=> current',
61+
group([
62+
animate('{{animationDuration}} cubic-bezier(0.4, 0.0, 0.2, 1)'),
63+
query('@*', animateChild(), {optional: true}),
64+
]),
65+
{
66+
params: {'animationDuration': DEFAULT_VERTICAL_ANIMATION_DURATION},
67+
},
68+
),
5269
]),
5370
};

0 commit comments

Comments
 (0)