Topic: Mif.Menu - hide menu when clicking other element?
My case: I want to add Mif.Menu to a file/item manager I've been working on. Files/items are representated as div block elements on the page. You can select one or more of them like in Finder or Explorer and you can drag/drop them etc.
Now I want to add Mif.Menu to enable quick actions like copy/paste. I can attach Mif.Menu to each file/item-div individually, but I probably attach it to the container (which could be document.body, or some div). I'm playing with both options, the first is ofcourse more memory intensive and probably not needed.
Anyway- when you right click a file/item-div I get the context menu as expected, which works fine. When you click on the document.body ("outside" the context menu) the menu hides as expected as well. However, when you (left) click on another file/item-div on the page, the Mif.Menu is not being closed. I expect the Mif.Menu to close to mimic OS behavior (I'm not focusing on the item anymore for which the Mif.Menu is being shown).
How can I get the menu to close?
Mind you, the file/item-divs you can click on to select have a e.stopPropagation() so the event doesn't go all the way to the body.
I thought of a maybe-solution (but requires changes in org. code): instead of adding mousedown to the document (in addHideOnExtraClick) you could use something like outerClick (http://cpojer.net/blog/Custom_outerClick_event) for closing the menu?
Thanks in advance