From 802e7346576cfd07f8632d00a35555afb4db4fde Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Sat, 28 Dec 2024 05:52:35 +1100 Subject: [PATCH] Fix deeply nested context menus remain open (#399) * nit - Remove redundant workaround * Fix deeply nested context menus remain open --- src/ContextMenu.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ContextMenu.ts b/src/ContextMenu.ts index d40f2f4..318a641 100644 --- a/src/ContextMenu.ts +++ b/src/ContextMenu.ts @@ -332,7 +332,7 @@ export class ContextMenu { } close(e?: MouseEvent, ignore_parent_menu?: boolean): void { - this.root.parentNode?.removeChild(this.root) + this.root.remove() if (this.parentMenu && !ignore_parent_menu) { this.parentMenu.lock = false this.parentMenu.current_submenu = null @@ -360,8 +360,6 @@ export class ContextMenu { ): CustomEvent { const evt = document.createEvent("CustomEvent") evt.initCustomEvent(event_name, true, true, params) // canBubble, cancelable, detail - // @ts-expect-error - evt.srcElement = origin if (element.dispatchEvent) element.dispatchEvent(evt) // @ts-expect-error else if (element.__events) element.__events.dispatchEvent(evt)