react-leaflet
react-leaflet copied to clipboard
Map resets its zoom after closing the marker popup
Bug report in v4
Before opening an issue, make sure to read the contributing guide and understand this is a bug tracker, not a support platform.
Please make sure to check the following boxes before submitting an issue.
Issues opened without using this template will be closed unless they have a good reason not to follow this template.
- [x] All peer dependencies are installed: React, ReactDOM and Leaflet.
- [x] Using the latest version of React and ReactDOM v18.
- [x] Using the supported version of Leaflet (v1.8.0 minimum) and its corresponding CSS file is loaded.
- [x] Using the latest v4 version of React-Leaflet.
- [x] The issue has not already been reported.
- [x] Make sure you have followed the quick start guide for Leaflet.
- [x] Make sure you have fully read the documentation and that you understand the limitations.
Expected behavior
When closing popup with X button - the map doesn't reset zoom
Actual behavior
When closing popup with X button - the map does reset zoom
Steps to reproduce
- Open https://react-leaflet.js.org/
- Scroll down the page to the map example
- Zoom in or zoom out several times
- Click on marker
- Click on X button on the popup
- Observe that map did reset zoom
Same here. It redirects to #close and triggers a rerender of a page. This is really annoying.
![leaflet-marker-close](https://user-images.githubusercontent.com/5194872/178540100-f2f87b8c-40fb-4fa2-add2-c92f941c0f15.png)
This is Leaflet's behavior, not something caused by React Leaflet.