You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Close button in default geocoder propagates clicks to map #720
When using the default geocoder from leaflet-routing-machine, clicking the close/delete button (with class .leaflet-routing-remove-waypoint) propagates the click event to the map layer. This causes unintended waypoint creation at the cursor position rather than cleanly deleting the waypoint entry.
Expected Behavior
Clicking the close button should only delete the waypoint entry without triggering any map interactions.
Actual Behavior
Click the close button on a geocoder entry
The waypoint is deleted
A new waypoint is immediately created at the cursor position on the map
Root Cause
The close button's click event bubbles up to the map layer because the default geocoder markup doesn't prevent event propagation on the geocoder container or close button elements.
Workaround
Until this is fixed upstream, projects can apply a runtime monkey patch to stop click propagation on the geocoder container:
// Patch leaflet-routing-machine geocoder to stop click propagationif(document.querySelector('.leaflet-routing-geocoders')){constcontainer=document.querySelector('.leaflet-routing-geocoders');if(container){container.addEventListener('click',(e)=>{e.stopPropagation();});}}
Activity