mirror of
https://github.com/material-components/material-web.git
synced 2024-10-05 17:48:16 +03:00
fix(menu): resolve aborted animations as false rather than reject
fixes #5638 PiperOrigin-RevId: 642044142
This commit is contained in:
parent
549efe057d
commit
4f7ff4f63a
@ -770,20 +770,18 @@ export abstract class Menu extends LitElement {
|
||||
*/
|
||||
private animateClose() {
|
||||
let resolve!: (value: unknown) => void;
|
||||
let reject!: () => void;
|
||||
|
||||
// This promise blocks the surface position controller from setting
|
||||
// display: none on the surface which will interfere with this animation.
|
||||
const animationEnded = new Promise((res, rej) => {
|
||||
const animationEnded = new Promise((res) => {
|
||||
resolve = res;
|
||||
reject = rej;
|
||||
});
|
||||
|
||||
const surfaceEl = this.surfaceEl;
|
||||
const slotEl = this.slotEl;
|
||||
|
||||
if (!surfaceEl || !slotEl) {
|
||||
reject();
|
||||
resolve(false);
|
||||
return animationEnded;
|
||||
}
|
||||
|
||||
@ -870,7 +868,7 @@ export abstract class Menu extends LitElement {
|
||||
animation.cancel();
|
||||
child.classList.toggle('md-menu-hidden', false);
|
||||
});
|
||||
reject();
|
||||
resolve(false);
|
||||
});
|
||||
|
||||
surfaceHeightAnimation.addEventListener('finish', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user