Skip to content

fix(select): fix panel close animation #1696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/select/select-animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you get those values? Seems like a more aggressive ease-out.

Copy link
Contributor Author

@kara kara Nov 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the Material 1 values for the ease out animation. I accidentally used the Material 1 values for the ease in animation here (copy-paste error).

]),
transition('* => void', [
animate('250ms linear', style({opacity: 0}))
animate('250ms 100ms linear', style({opacity: 0}))
])
]);

Expand Down
9 changes: 6 additions & 3 deletions src/lib/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the comment above to reflect the code.

}

/** Whether or not the overlay panel is open. */
Expand Down Expand Up @@ -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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the comment above to reflect the code.

this._focusCorrectOption();
this.onOpen.emit();
} else {
this._focusHost();
this.onClose.emit();
}
}
Expand Down