mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(select): fix menu close animation (#1696)
This commit is contained in:
@@ -58,10 +58,10 @@ export const transformPanel: AnimationEntryMetadata = trigger('transformPanel',
|
||||
width: '100%',
|
||||
transform: `translate3d(0, 0, 0) scaleY(0)`
|
||||
}),
|
||||
animate(`150ms cubic-bezier(0.55, 0, 0.55, 0.2)`)
|
||||
animate(`150ms cubic-bezier(0.25, 0.8, 0.25, 1)`)
|
||||
]),
|
||||
transition('* => void', [
|
||||
animate('250ms linear', style({opacity: 0}))
|
||||
animate('250ms 100ms linear', style({opacity: 0}))
|
||||
])
|
||||
]);
|
||||
|
||||
|
||||
@@ -105,9 +105,10 @@ export class MdSelect implements AfterContentInit, OnDestroy {
|
||||
this._panelOpen = true;
|
||||
}
|
||||
|
||||
/** Closes the overlay panel. */
|
||||
/** Closes the overlay panel and focuses the host element. */
|
||||
close(): void {
|
||||
this._panelOpen = false;
|
||||
this._focusHost();
|
||||
}
|
||||
|
||||
/** Whether or not the overlay panel is open. */
|
||||
@@ -152,13 +153,15 @@ export class MdSelect implements AfterContentInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
/** Emits an event and sets focus when overlay panel is finished animating. */
|
||||
/**
|
||||
* When the panel is finished animating, emits an event and focuses
|
||||
* an option if the panel is open.
|
||||
*/
|
||||
_onPanelDone(): void {
|
||||
if (this.panelOpen) {
|
||||
this._focusCorrectOption();
|
||||
this.onOpen.emit();
|
||||
} else {
|
||||
this._focusHost();
|
||||
this.onClose.emit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user