mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-23 22:40:20 +08:00
Close all other contextmenus when a new menu item is opened
This commit is contained in:
parent
b2f2c557e9
commit
2a748f1884
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user