minutemailer / react-popup

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

Closing popup with back button #57

Closed sevban closed 5 years ago

sevban commented 6 years ago

Is it possible to close the popup with android back button or browser back button?

tbleckert commented 5 years ago

It's possible. We won't add it as a feature but I think it should be handled outside anyway.

You have to available events for this, open (addOpenListener) and close (addCloseListener). My suggestion is that you add a hash to the URL like "#popupOpen" then add a hashchanged listener to detect if "#popupOpen" gets removed, and if so, call Popup.close().