minutemailer / react-popup

React popup component
http://minutemailer.github.io/react-popup/
MIT License
208 stars 71 forks source link

Dont want to close the popup when the user clicks outside the popup #20

Closed panbhag closed 7 years ago

panbhag commented 7 years ago

I don't want the popup to be closed when the user clicks outside the popup. Is this possible?

tbleckert commented 7 years ago

It's not really possible at the moment but is of course a good feature that would fit well in the settings. The way it works is that we have a click handler on the overlay, so you could get around this issue by disabling clicks on the overlay, or if you don't use the overlay visually you could play with the positioning/size of it.

I will get back to you later this week and we'll have this setting implemented. If you're up for it, feel free to submit a PR, always appreciated.

BradStell commented 7 years ago

I would like this functionality as well!

tbleckert commented 7 years ago

This has now been added in v0.7.1. Simply set closeOnOutsideClick to false as a property on the component. You can also use closeOnOutsideClick when creating a popup if you only need it on special occasions, examples in the docs.

Please note that since version 0.7.0, the Popup.prompt method has been removed. It's better suitable as a plugin, see demo page for example.