useModal

Hides content outside the current <OverlayContainer> from screen readers on mount and restores it on unmount. Typically used by modal dialogs and other types of overlays to ensure that only the top-most modal is accessible at once.

installyarn add react-aria
version3.20.0
usageimport {useModal} from 'react-aria'

API#


useModal( (options?: AriaModalOptions )): ModalAria

Example#


See useDialog and useOverlayTrigger for examples of using useModal to hide external elements from screen readers.