Close all other contextmenus when a new menu item is opened

This commit is contained in:
Nariman Jelveh 2024-06-17 09:41:22 -07:00
parent b2f2c557e9
commit 2a748f1884

View File

@ -533,12 +533,16 @@ window.addEventListener('message', async (event) => {
const open_menu = ({ i, pos, parent_element, items }) => {
let delay = true;
if ( state_open ) {
// if already open, keep it open
if ( current_i === i ) return;
delay = false;
current && current.cancel({ meta: 'menubar', fade: false });
}
// Close all other context menus
$('.context-menu').remove();
// Set this menubar button as active
menubar_buttons.forEach(el => el.removeClass('active'));
menubar_buttons[i].addClass('active');