[Bug] Removing a MapboxOverlay control doesn't remove its parent div
@Pessimistress is already working on this.
Since May 24, 2024.
- Dominant language
- TypeScript
- Stars
- 14.6k
- Forks
- 2.3k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 42
Description
Description
When removing a MapboxOverlay with map.removeControl(mapboxOverlay), the canvas is removed, but not its parent div. As a result, if the overlay is repeatedly added and removed, empty divs accumulate in the Mapbox <div class="mapbox-ctrl-top-left"> element.
An example of a div left behind is <div tabindex="0" style="position: absolute; left: 0px; top: 0px; text-align: initial; pointer-events: none; width: 1417px; height: 906px; touch-action: none; outline: currentcolor; cursor: grab;"></div>.
Flavors
- Script tag
- React
- Python/Jupyter notebook
- MapboxOverlay
- GoogleMapsOverlay
- CartoLayer
- ArcGIS
Expected Behavior
The parent div of the MapboxOverlay canvas should be removed when map.removeControl(mapboxOverlay) is called.
Steps to Reproduce
This CodePen adds a MapboxOverlay and then removes it one second layer, leaving the empty div behind: https://codepen.io/eloyer/pen/LYoNqwZ
Environment
- Framework version: deck.gl@9.0.14
- Browser: Chrome 124.0
- OS: MacOS 14.2.1
Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.