I've just checked this with Zimbra 8.6.0.
// You should run this code after "Mail" app initialization
// (after its tab activation if you want to check this manually via browser console or
// after "app launched" event notification in your zimlet, see ZmZimletBase.prototype.appLaunch documentation)
var ml = DwtControl.ALL_BY_ID["zl__CLV-main"];
var menu = new ZmPopupMenu(ml);
var mi = menu.createMenuItem("some_id", {text: "Click me"});
mi.addSelectionListener(new AjxListener(null, function(){ console.log("you've just clicked 'Click me' menu item") }));
menu.createSeparator();
mi = menu.createMenuItem("another_id", {text: "Another action"});
mi.addSelectionListener(new AjxListener(null, function(){ console.log("you've just clicked 'Another action' menu item") }));
var listeners = ml._evtMgr._listeners[ZmEvent.S_ACTION];
listeners.removeAll();
var listener = new AjxListener(null, function(ev) {
menu.setLocation(ev.docX, ev.docY);
menu.popup();
});
listeners.add(listener);