From a3ec7bb5ad9b9c2b2386f3bfce6fe525071b40b8 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Thu, 25 Apr 2024 23:14:39 -0700 Subject: [PATCH] Fix the issue with context submenu not closing parent menu when clicked --- src/UI/UIContextMenu.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/UI/UIContextMenu.js b/src/UI/UIContextMenu.js index 15065267..9f5f65d3 100644 --- a/src/UI/UIContextMenu.js +++ b/src/UI/UIContextMenu.js @@ -135,8 +135,8 @@ function UIContextMenu(options){ $('.context-menu').not(contextMenu).removeClass('context-menu-active'); let cancel_options_ = null; - const fade_remove = () => { - $(`#context-menu-${menu_id}, .context-menu[data-element-id="${$(this).closest('.context-menu').attr('data-parent-id')}"]`).fadeOut(200, function(){ + const fade_remove = (item) => { + $(`#context-menu-${menu_id}, .context-menu[data-element-id="${$(item).closest('.context-menu').attr('data-parent-id')}"]`).fadeOut(200, function(){ $(contextMenu).remove(); }); }; @@ -159,7 +159,7 @@ function UIContextMenu(options){ } // close menu and, if exists, its parent if(!$(this).hasClass('context-menu-item-submenu')){ - fade_remove(); + fade_remove(this); } return false; });