Skip to content

Commit

Permalink
fix race condition in submenu-controller (#1815)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyantree committed Feb 20, 2024
1 parent e1102ba commit 298892b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/menu-item/submenu-controller.ts
Expand Up @@ -229,6 +229,7 @@ export class SubmenuController implements ReactiveController {
// newly opened menu.
private enableSubmenu(delay = true) {
if (delay) {
window.clearTimeout(this.enableSubmenuTimer);
this.enableSubmenuTimer = window.setTimeout(() => {
this.setSubmenuState(true);
}, this.submenuOpenDelay);
Expand All @@ -238,7 +239,7 @@ export class SubmenuController implements ReactiveController {
}

private disableSubmenu() {
clearTimeout(this.enableSubmenuTimer);
window.clearTimeout(this.enableSubmenuTimer);
this.setSubmenuState(false);
}

Expand Down

0 comments on commit 298892b

Please sign in to comment.