Fix role for Dialog component, should be dialog, not alertdialog #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was using the dialog example code, then after reading https://www.w3.org/WAI/ARIA/apg/patterns/dialogmodal/
to better understand the accessibility requirements, I changed to use
AlertDialog
, then I got the<DialogOverlay> must be used inside a <Dialog>
error not understanding why I got this error. I dug into the code and understood that all the tags needs to be changed to the Alert variant, soAlertDialogOverlay
,AlertDialogPanel
etc.Is there a technical difficulty of using the same components and setting the correct
role
attribute to theDialogControlled
/DialogUncontrolled
component? Wouldn't it be better to have only one code to maintain?I compared the code of all those components to find there was actually no difference, excepted some import sorting.
From the documentation linked above, the only difference should be the
role
, sorole="alertdialog"
forAlertDialog
androle="dialog"
for theDialog
component. For Dialog, this is currently wrongly set torole="alertdialog"
, this PR fixes it.