DialogTrigger question in RAC #6815
-
Good afternoon, I am just trying to understand a proper usage for DialogTrigger. https://react-spectrum.adobe.com/react-aria/Dialog.html#example. Should this Trigger only be used when using a button to open a child modal/dialog? If I wanted to trigger a child modal/dialog from some sort of background process rather than a button, would the correct usage be something like this?
I noticed when wrapping a DialogTrigger in the above example like so:
The nested children in the Dialog trigger was actually being mounted even when shouldOpen was false (not sure if DialogTrigger was the true cause), which led me to actually blowing up Chrome with a lot of Modals 🤣. Is my understanding correct that DialogTriggers should only be used when the immediate child is a Button? Thanks for this awesome library BTW!! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, DialogTrigger must be paired with a trigger element. To do a background process dialog, you can follow this example https://react-spectrum.adobe.com/react-aria/Modal.html#controlled-open-state |
Beta Was this translation helpful? Give feedback.
Yes, DialogTrigger must be paired with a trigger element.
To do a background process dialog, you can follow this example https://react-spectrum.adobe.com/react-aria/Modal.html#controlled-open-state