Fix the issue with context submenu not closing parent menu when clicked

This commit is contained in:
Nariman Jelveh 2024-04-25 23:14:39 -07:00
parent faa72fd97c
commit a3ec7bb5ad

View File

@ -135,8 +135,8 @@ function UIContextMenu(options){
$('.context-menu').not(contextMenu).removeClass('context-menu-active'); $('.context-menu').not(contextMenu).removeClass('context-menu-active');
let cancel_options_ = null; let cancel_options_ = null;
const fade_remove = () => { const fade_remove = (item) => {
$(`#context-menu-${menu_id}, .context-menu[data-element-id="${$(this).closest('.context-menu').attr('data-parent-id')}"]`).fadeOut(200, function(){ $(`#context-menu-${menu_id}, .context-menu[data-element-id="${$(item).closest('.context-menu').attr('data-parent-id')}"]`).fadeOut(200, function(){
$(contextMenu).remove(); $(contextMenu).remove();
}); });
}; };
@ -159,7 +159,7 @@ function UIContextMenu(options){
} }
// close menu and, if exists, its parent // close menu and, if exists, its parent
if(!$(this).hasClass('context-menu-item-submenu')){ if(!$(this).hasClass('context-menu-item-submenu')){
fade_remove(); fade_remove(this);
} }
return false; return false;
}); });