-
Notifications
You must be signed in to change notification settings - Fork 616
Add aria-modal
attribute to Dialog
(V2) element
#2851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: d8745e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -302,6 +302,7 @@ const _Dialog = React.forwardRef<HTMLDivElement, React.PropsWithChildren<DialogP | |||
role={role} | |||
aria-labelledby={dialogLabelId} | |||
aria-describedby={dialogDescriptionId} | |||
aria-modal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered adding a prop to allow users to override this, but since we don't allow them to override the focus zone or exit behavior, there is no valid scenario in which this dialog is not modal. And the role
prop is restricted to dialog
or alertdialog
so there is no potential for conflict there.
size-limit report 📦
|
Adds the
aria-modal
attribute to the container for theDialogV2
element. This is required because the dialog always instantiates a focus trap. The only way to interact with the underlying page is to close the dialog:Adding
aria-modal
prevents screen readers from continuing past the dialog and starting to read the underlying content, which they will do without the attribute.Closes #2814