pradel / react-responsive-modal

Simple responsive react modal
https://react-responsive-modal.leopradel.com/
MIT License
604 stars 95 forks source link

Add keepMounted option and fix screen glitch #516

Open pikaju opened 1 year ago

pikaju commented 1 year ago

Adds option that keeps the Modal mounted even when it is hidden. This is useful for keeping the DOM state inside the Modal as well as for SEO purposes.

Fixes #233 and #495

pradel commented 1 year ago

Thanks for the pr! Could you please add an example in the docs so I can try it?

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.16 :tada:

Comparison is base (16aad65) 95.28% compared to head (d2c9bb4) 95.45%.

:exclamation: Current head d2c9bb4 differs from pull request most recent head 11fd42a. Consider uploading reports for the commit 11fd42a to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #516 +/- ## ========================================== + Coverage 95.28% 95.45% +0.16% ========================================== Files 6 6 Lines 191 198 +7 Branches 69 74 +5 ========================================== + Hits 182 189 +7 Misses 9 9 ``` | [Impacted Files](https://codecov.io/gh/pradel/react-responsive-modal/pull/516?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=L%C3%A9o+Pradel) | Coverage Δ | | |---|---|---| | [react-responsive-modal/src/index.tsx](https://codecov.io/gh/pradel/react-responsive-modal/pull/516?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=L%C3%A9o+Pradel#diff-cmVhY3QtcmVzcG9uc2l2ZS1tb2RhbC9zcmMvaW5kZXgudHN4) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=L%C3%A9o+Pradel). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=L%C3%A9o+Pradel)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

pikaju commented 1 year ago

Hey @pradel, thanks for the response. I added an example and docs in the Next project.

I also changed how modals are centered, from the "inline" behavior to flex-box centering. I did this because there was an issue when the modal had little space (e.g. on a mobile device) and the pseudo-element you had before was wrapped to a new line. This implementation doesn't do that.

pradel commented 1 year ago

@pikaju could you please split the pr into two parts?

pikaju commented 1 year ago

@pradel Sorry, but that doesn't seem worth the effort, I suggest just releasing a new major version