Skip to content

Commit 3cd6776

Browse files
karajelbourn
authored andcommitted
fix(select): fix menu close animation (#1696)
1 parent 3f4734c commit 3cd6776

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/lib/select/select-animations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ export const transformPanel: AnimationEntryMetadata = trigger('transformPanel',
5858
width: '100%',
5959
transform: `translate3d(0, 0, 0) scaleY(0)`
6060
}),
61-
animate(`150ms cubic-bezier(0.55, 0, 0.55, 0.2)`)
61+
animate(`150ms cubic-bezier(0.25, 0.8, 0.25, 1)`)
6262
]),
6363
transition('* => void', [
64-
animate('250ms linear', style({opacity: 0}))
64+
animate('250ms 100ms linear', style({opacity: 0}))
6565
])
6666
]);
6767

src/lib/select/select.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ export class MdSelect implements AfterContentInit, OnDestroy {
105105
this._panelOpen = true;
106106
}
107107

108-
/** Closes the overlay panel. */
108+
/** Closes the overlay panel and focuses the host element. */
109109
close(): void {
110110
this._panelOpen = false;
111+
this._focusHost();
111112
}
112113

113114
/** Whether or not the overlay panel is open. */
@@ -152,13 +153,15 @@ export class MdSelect implements AfterContentInit, OnDestroy {
152153
}
153154
}
154155

155-
/** Emits an event and sets focus when overlay panel is finished animating. */
156+
/**
157+
* When the panel is finished animating, emits an event and focuses
158+
* an option if the panel is open.
159+
*/
156160
_onPanelDone(): void {
157161
if (this.panelOpen) {
158162
this._focusCorrectOption();
159163
this.onOpen.emit();
160164
} else {
161-
this._focusHost();
162165
this.onClose.emit();
163166
}
164167
}

0 commit comments

Comments
 (0)