react-modal icon indicating copy to clipboard operation
react-modal copied to clipboard

How to keep modal content alive after modal is closed?

Open billyzkid opened this issue 4 years ago • 0 comments

Summary:

I'd like to have a modal that uses the exact same content each time it is opened/closed, rather than removing the content element from the DOM each times the modal is closed and recreating it each time the modal is opened.

My use case is a modal containing an iframe that hosts a Spotify playlist widget. The user can open the modal and click the play button to start the music, close the modal and keep listening to the music, open the modal again and select a new song from the playlist, etc.

Currently, it seems the default behavior of the modal is to always remove the overlay/content elements from the DOM, which causes the music to stop playing obviously.

Is this possible?

Steps to reproduce:

Expected behavior:

Link to example of issue:

Additional notes:

billyzkid avatar Mar 16 '21 00:03 billyzkid