In my leaflet map, clicking on a marker opens its popup and immediately closes it.
Logging of map events reveals that instead of firing just a popupopen event, the click on the marker triggers 2 events - popupopen followed by popupclose of the same marker.
This behavior is semi-consistent:
popupopen event is fired, without popupclose following it).I debugged the source of the popupclose event, and was suprised to discover that the _openPopup function in src/layer/Popup.js:473 is invoked twice. This method ends up calling this.closePopup() on the second invocation.
Note sure it if's related, but looking at click events on the map, I see in Safari two such events per mouse click, both having an original event of type MouseEvent. In Chrome, when things work correctly, there is just a single event with an original event of PointerEvent.
I suspect that this could be related to #7255, however unfortunately the recommended workaround of setting tap to false didn't help.
Any ideas what could be the cause and how to work around it?
Using Leaflet 1.7.1 through react-leaflet 3.2.1.
Update:
It turns out that setting tap to false actually did resolve this!
Not sure how I missed this previously. Definitely one of the more frustrating third-party issues I encountered recently!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With