Recommendations for nesting/chaining dialogs? #6438
-
Hello everyone ! I have a need to nest dialogs:
I managed to do something like that : But it feels a bit awkwards that closing the second dialog is responsible for closing the first one: ideally I'd like pressing the button that opens the 2nd dialog is actually responsible for closing the 1st dialog. One of the rationales is that I wish the 1st dialog would not be visible through the backdrop of the 2nd modal dialog. However if I close the 1st dialog, the second one is closed as well as it's a nested dialog. I am looking at a way to easily chain the dialogs, if possible without adding complex controlled state logic. Any suggestion how I should do this with RAC? And advises on maintaining accessibility? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
It looks like you've hooked up the close1 function to the close button of the 2nd dialog? We don't typically recommend nesting like this however. Typically it's better to close the Popup, then open the Dialog. See an example here https://react-spectrum.adobe.com/react-spectrum/DialogContainer.html#dialog-triggered-by-a-menu-item Or with RAC https://react-spectrum.adobe.com/react-aria/index.html on the main example, you can access a Table row's action menu, then click the "Edit" button to launch into a modal Dialog. |
Beta Was this translation helpful? Give feedback.
It looks like you've hooked up the close1 function to the close button of the 2nd dialog?
We don't typically recommend nesting like this however. Typically it's better to close the Popup, then open the Dialog. See an example here https://react-spectrum.adobe.com/react-spectrum/DialogContainer.html#dialog-triggered-by-a-menu-item
Or with RAC https://react-spectrum.adobe.com/react-aria/index.html on the main example, you can access a Table row's action menu, then click the "Edit" button to launch into a modal Dialog.