diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0a99e9dd..5590c1f16d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ ### 🐞 Bug fixes -- _...Add new stuff here..._ +- Remove closeButton event listener on popup.remove(). ## 5.1.1 diff --git a/src/ui/popup.ts b/src/ui/popup.ts index 51baf42b52..3e70fc3420 100644 --- a/src/ui/popup.ts +++ b/src/ui/popup.ts @@ -273,6 +273,10 @@ export class Popup extends Evented { delete this._container; } + if(this._closeButton){ + this._closeButton.removeEventListener('click', this._onClose); + } + if (this._map) { this._map.off('move', this._update); this._map.off('move', this._onClose);