A dialog is a popup that prompts a user to respond to some information. There are two kinds of dialogs:
- Modal dialogs
- Non-modal dialogs
Modal means you cannot interact with things outside the dialog when the dialog is open.
If you have a Modal dialog, you need to prevent users from interacting with things outside of the dialog. You can do this with aria-modal.
Aria-modal
aria-modal tells a screen reader whether the element is a modal dialog. It can be true or false.
true: Element is a modal dialogfalse: Element is not a modal dialog
If a modal with aria-modal="true" is shown, screen readers should only be able to interact with that modal.
Unfortunately, not all screen readers support aria-modal at the moment.
Emulating aria-modal
We can emulate aria-modal behavior by adding aria-hidden to other elements when the modal is opened.
Welcome! Unfortunately, you donβt have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson