Open davidjamescarter opened 5 years ago
I've found setting closeOnOutsideClick
and triggering openPortal
doesn't open the portal at all..
@davidcarter-me i might have a solution for you.
When you click stuff inside the portal, changing state on a parent element causes a render on the click target. When this event bubbles to the Portal, the contains
check inside the portals closeOnOutsideClick
cannot reference the e.target
I worked around this by wrapping the state changing method in requestAnimationFrame
, so the closeOnOutsideClick
resolver runs first, and then the state change.
Hope that helps
I have found that when using the PortalWithState with closeOnOutsideClick my modal will close when using state to conditionally render components.
Changing state to edit: true. Causes modal to close.
Has anyone else experienced, have a fix? Going to see if I can figure out a fix locally and PR if so.