Nested Dialog
Components
DialogOpen a new window that can be either modal or non-modal and optionally rendered in a React portal. This component is based on the WAI-ARIA Dialog Pattern.
ButtonTrigger an action or event, such as submitting a Form, opening a Dialog, canceling an action, or performing a delete operation in React. This component is based on the WAI-ARIA Button Pattern.
VisuallyHiddenHide an element visually but keep it available for screen readers and other assistive technologies.
Identifying nested dialogs
There are three ways Ariakit can identify nested dialogs:
- 1
They are nested in the React tree.
- 2
They are appended to the body element after the parent dialog is opened.
- 3
They are referenced in the
getPersistentElements
prop of the parent dialog.
In this example, we're using the second method. By passing the unmountOnHide
prop to the nested dialog, it's rendered only when the dialog is open. This is the same strategy used by the Dialog module to support third-party dialogs and browser extensions that open popups, such as 1Password, Google Translate, and Grammarly.