Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X button doesn't close manually added Popups #423

Closed
JasonSanford opened this issue Jan 6, 2012 · 4 comments
Closed

X button doesn't close manually added Popups #423

JasonSanford opened this issue Jan 6, 2012 · 4 comments
Assignees
Labels
Milestone

Comments

@JasonSanford
Copy link
Member

If you manually create a Popup with myPopup = new L.Popup() it's impossible to close it with the close button at the top right. Using myMap.removeLayer(myPopup) does seem to work though.

I made a quick example to show what's happening.

@JasonSanford
Copy link
Member Author

Adding this._map.removeLayer(this); after line 73 of Popup.js seems to fix this, but not sure if this is the proper way to handle it.

@aceiii
Copy link
Contributor

aceiii commented Jan 12, 2012

The close button calls the closePopup() function on the map that it's attached so, but that function only closes the popup that's only that has been opened through map.openPopup(). Perhaps the close button should be able to remove itself without having to use the map's closePopup function or not have it show up at all if it were attached to the map through the addLayer function.

@JasonSanford
Copy link
Member Author

I'd vote for the popup being able to close itself instead of the popup not having a close button.

@mourner
Copy link
Member

mourner commented Jan 16, 2012

You're right guys, the popup should be able to close itself. I don't remember why I used map.closePopup there but it should be fixed.

@ghost ghost assigned mourner Jan 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants