Skip to content

Commit 4f7ff4f

Browse files
Elliott Marquezcopybara-github
authored andcommitted
fix(menu): resolve aborted animations as false rather than reject
fixes #5638 PiperOrigin-RevId: 642044142
1 parent 549efe0 commit 4f7ff4f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

menu/internal/menu.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -770,20 +770,18 @@ export abstract class Menu extends LitElement {
770770
*/
771771
private animateClose() {
772772
let resolve!: (value: unknown) => void;
773-
let reject!: () => void;
774773

775774
// This promise blocks the surface position controller from setting
776775
// display: none on the surface which will interfere with this animation.
777-
const animationEnded = new Promise((res, rej) => {
776+
const animationEnded = new Promise((res) => {
778777
resolve = res;
779-
reject = rej;
780778
});
781779

782780
const surfaceEl = this.surfaceEl;
783781
const slotEl = this.slotEl;
784782

785783
if (!surfaceEl || !slotEl) {
786-
reject();
784+
resolve(false);
787785
return animationEnded;
788786
}
789787

@@ -870,7 +868,7 @@ export abstract class Menu extends LitElement {
870868
animation.cancel();
871869
child.classList.toggle('md-menu-hidden', false);
872870
});
873-
reject();
871+
resolve(false);
874872
});
875873

876874
surfaceHeightAnimation.addEventListener('finish', () => {

0 commit comments

Comments
 (0)