How do I stop event propagation with rightclick on Leaflet marker?

Try this internal function:

L.DomEvent.stopPropagation(event);

It should do the trick.

P.S. I never found that in any documentation but saw it used in a patch. Use at your own risk. ;)

Edit: I also found this internal function

L.DomEvent.preventDefault(event);

Which seems to be very much the same as event.preventDefault() which is in jQuery.


Preventing default behavior in IE and all other browsers:

event.returnValue = false;
if (event.preventDefault) event.preventDefault();

My first answer was apparently not working and as I am now facing the same problem. Here is a new approach:

Leaflet supports an event called contextmenu. As found in the Leaflet event documentation here.

Fired when the user pushes the right mouse button on the map, prevents default browser context menu from showing if there are listeners on this event.

So theoretically the code

marker.on('contextmenu', function(e) {
  this.openPopup();
});

should work just fine. But apparently the implementation lags behind the documentation. As of now (Leaflet 0.4.5) the contextmenu event is apparently not yet supported on markers, although it works perfectly fine on polyline objects.

There seems to be work in the pipeline to enable this feature in the near future (see discussions here and here). So, I guess we can just hope that Leaflet works on this quickly and enables the event in the next release...

Edit: Disregard what I said about waiting for the implementation. If you download the latest development master branch and build leaflet yourself you get full support for contextmenu events on markers. Happy coding.