fix(select): fix menu close animation (#1696)

This commit is contained in:
Kara
2016-11-03 15:54:56 -07:00
committed by Jeremy Elbourn
parent 3f4734c7fa
commit 3cd6776ea2
2 changed files with 8 additions and 5 deletions
+2 -2
View File
@@ -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}))
])
]);
+6 -3
View File
@@ -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();
}
}