diff --git a/docs/src/content/docs/resources/changelog.md b/docs/src/content/docs/resources/changelog.md index 44f4be54e..ebd05c364 100644 --- a/docs/src/content/docs/resources/changelog.md +++ b/docs/src/content/docs/resources/changelog.md @@ -28,6 +28,7 @@ New versions of Web Awesome are released as-needed and generally occur when a cr - Fixed a bug in `` that caused the menu to not close when rendered in a shadow root [#1878] - Fixed a bug in `` that caused a new stacking context resulting in tooltips being clipped [#1709] - Fixed a bug in `` that caused the scroll controls to toggle indefinitely when zoomed in Safari [#1839] +- Fixed a bug in the submenu controller that allowed two submenus to be open at the same time [#1880] ## 2.14.0 diff --git a/src/components/menu-item/submenu-controller.ts b/src/components/menu-item/submenu-controller.ts index 58ceb74bd..166e9c042 100644 --- a/src/components/menu-item/submenu-controller.ts +++ b/src/components/menu-item/submenu-controller.ts @@ -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); @@ -238,7 +239,7 @@ export class SubmenuController implements ReactiveController { } private disableSubmenu() { - clearTimeout(this.enableSubmenuTimer); + window.clearTimeout(this.enableSubmenuTimer); this.setSubmenuState(false); }