Skip to content

Commit a6409a3

Browse files
committed
fix leave-animation of select panel not working due to angular/angular#23302
1 parent 3892dd6 commit a6409a3

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/lib/select/select-animations.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
import {
1010
animate,
11+
animateChild,
1112
AnimationTriggerMetadata,
13+
query,
1214
state,
1315
style,
1416
transition,
@@ -22,9 +24,20 @@ import {
2224
* The values below match the implementation of the AngularJS Material mat-select animation.
2325
*/
2426
export const matSelectAnimations: {
27+
readonly transformPanelWrap: AnimationTriggerMetadata;
2528
readonly transformPanel: AnimationTriggerMetadata;
2629
readonly fadeInContent: AnimationTriggerMetadata;
2730
} = {
31+
/**
32+
* This animation ensures the select's overlay panel animation (transformPanel) is called when
33+
* closing the select.
34+
* This is needed due to https://github.com/angular/angular/issues/23302
35+
*/
36+
transformPanelWrap: trigger('transformPanelWrap', [
37+
transition('* => void', query('@transformPanel', [animateChild()],
38+
{optional: true}))
39+
]),
40+
2841
/**
2942
* This animation transforms the select's overlay panel on and off the page.
3043
*

src/lib/select/select.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
(backdropClick)="close()"
3030
(attach)="_onAttached()"
3131
(detach)="close()">
32-
<div class="mat-select-panel-wrap">
32+
<div class="mat-select-panel-wrap" [@transformPanelWrap]>
3333
<div
3434
#panel
3535
class="mat-select-panel {{ _getPanelTheme() }}"

src/lib/select/select.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ export class MatSelectTrigger {}
220220
'(blur)': '_onBlur()',
221221
},
222222
animations: [
223+
matSelectAnimations.transformPanelWrap,
223224
matSelectAnimations.transformPanel
224225
],
225226
providers: [

0 commit comments

Comments
 (0)