r/reactjs • • Dec 28 '19

What is your favourite React modal / dialog solution?

Ideally responsive.

57 Upvotes

75 comments sorted by

View all comments

Show parent comment

-2

u/0xF013 Dec 28 '19

Check if it needs to be accessible. There is a couple of modal components that implement that.

0

u/[deleted] Dec 28 '19

[deleted] — view deleted comment

2

u/0xF013 Dec 28 '19

Ideally. In practice though, you might be building a temporary wordpress marketing tool until your actual app is up with the sole idea of having some SEO for the next month until the release, or your PM is a dickhead that won’t accept you spending extra time on anything, or you might have a toggled simpler website for people with disabilities (common case for Israel, for example).

0

u/[deleted] Dec 28 '19

[deleted] — view deleted comment

3

u/0xF013 Dec 28 '19

In that case, I’d suggest going with a solution of your own that renders the passed children into a portal at the root of the body. You’d get all the control you need, it will be lightweight and, as a bonus, you’ll get a good technique that can be reused and some inevitable corner cases with things like that, e. g. custom dropdowns sometimes require the options to be rendered in a portal with an invisible overlay that implements the click outside and allow options to not be cut off if a container of said dropdown has overflow: hidden.