Skip to content

Popup Not Closed Cleanly #1641

@cfis

Description

@cfis

Create a layer, bind a popup to it. Click the layer to open the popup. Now click someplace else on the map.

The popup will close, but map._popup will remain set. This means its impossible for other code to detect if a popup is still open. This is helpful - for example when trying to decide whether to show a label on map (see Leaflet/Leaflet.label#30)

The problem is that L.Popup._close is not correctly going through the map api.

_close: function () {
    if (this._map) {
        this._map.removeLayer(this);
    }
},

This method should be:

_close: function () {
    if (this._map) {
        this._map.closePopup(this);
    }
},

Thanks - Charlie

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions