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/overlays
version3.6.3
usageimport {useModal} from '@react-aria/overlays'

API#


useModal( (options: ModalOptions )): ModalAria

Example#


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