Skip to content

Commit

Permalink
Fix deeply nested context menus remain open (#399)
Browse files Browse the repository at this point in the history
* nit - Remove redundant workaround

* Fix deeply nested context menus remain open
  • Loading branch information
webfiltered authored Dec 27, 2024
1 parent 0b161c1 commit 802e734
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/ContextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 802e734

Please sign in to comment.