stefanocudini / leaflet-search

Search stuff in a Leaflet map
https://opengeo.tech/maps/leaflet-search/
MIT License
780 stars 335 forks source link

scroll problem on search results with firefox #299

Closed pouemes closed 1 year ago

pouemes commented 2 years ago

take this example with leaflet-search 3.02 https://opengeo.tech/maps/leaflet-search/examples/geojson-layer.html replace https://unpkg.com/leaflet@1.3.0/dist/leaflet.css and https://unpkg.com/leaflet@1.3.0/dist/leaflet.js by leaflet version 1.7.1 or 1.8.0

search for m then try to scroll on the result, if it work with chrome edge and opera, it doen't work with firefox pehaps someone could understand why?

Falke-Design commented 2 years ago

This is a issue with the plugin / Firefox, because it uses the old mousewheel event listener instead of wheel to prevent zooming on the map. Firefox doesn't fire mousewheel anymore: https://plnkr.co/edit/sbrPjG2j2GRJ3Av0

You use this simple workaround:

 your code ....
// adding the controller to the map
map.addControl( searchControl ); // or searchControl.addTo(map);

// disable zoom scrolling in the search container
L.DomEvent.disableScrollPropagation(searchControl.getContainer());
pouemes commented 2 years ago

yes work now: in leaflet-search.src.js line 318 replace .on(tool, 'mousewheel', function(e) { by .on(tool, 'wheel', function(e) {