I'm trying to listen to a right-click event on a document, on which a pop-up menu (goog.ui.popupmenu) should be created. The very first time, the menu is created on right-click, but after that its created even on left clicks.
I tried detaching the object from the element when the first time event is received. But that doesnt seem to work.
Here's what I'm doing:
goog.events.listen(element, goog.events.EventType.CONTEXTMENU, function(e) {
e.preventDefault();
this.menu();
}, true, this);
I'm testing this code on Chrome.