Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click on polyline also triggers map's click handler, although click on marker and v0.7.7 do not #5313

Closed
RhinoDevel opened this issue Feb 7, 2017 · 4 comments

Comments

@RhinoDevel
Copy link

Using Leaflet v1.0.3 release, e.g. with Firefox 51.0.1 & Chrome 55:

If a polyline and the map have click event handlers,
both event handler functions will be called when polyline got clicked by user.

Expected behavior is that only the polyline's handler function is getting called.

This is expected, because the last version I tried (Leaflet v0.7.7 release) shows
that behavior and even Leaflet v1.0.3 release acts this way, if a marker is clicked
instead of a polyline.

Please take a look at this example: https://jsfiddle.net/rno4htgr/18/

@RhinoDevel
Copy link
Author

Calling L.DomEvent.stopPropagation(e); inside polyline's click event handler is a workaround.

See: https://jsfiddle.net/q71v4ed8/2/

@IvanSanchez
Copy link
Member

Expected behavior is that only the polyline's handler function is getting called.

No.

The expected behaviour is that layer events get propagated to the map (through any layergroups they might be a part of). This happens since #3307 .

See also #4883 .

@RhinoDevel
Copy link
Author

Thanks for the quick reply and sorry for the noise!

@IvanSanchez
Copy link
Member

No prob :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants