I didn't find a rightclick event in Leaflet markers so I started listening to the mousedown event. In the method that resolves this event I check
if (event.originalEvent.button == 2) {
do_something();
// now i want to stop propagation of the rightclick
return;
}
This does work in that do_something() is called, but the event propagates to the map and a contextmenu is being shown. How do I prevent the event to propagate to the map?
Does this work in all major (i.e. IE) browsers?
Best Answer
Try this internal function:
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
Which seems to be very much the same as
event.preventDefault()
which is in jQuery.