Bug report
Current Behavior
When a dialog is created without a description, there's a warning (in non-production environments) that there's a missing description (code reference):
Warning: Missing `Description` or `aria-describedby={undefined}` for {DialogContent}
Expected behavior
Creating a dialog without a description shouldn't have a warning.
In the APG dialog pattern, aria-describedby is optional, and there are legitimate reasons to not need it:
Optionally, the aria-describedby property is set on the element with the dialog role to indicate which element or elements in the dialog contain content that describes the primary purpose or message of the dialog. Specifying descriptive elements enables screen readers to announce the description along with the dialog title and initially focused element when the dialog opens, which is typically helpful only when the descriptive content is simple and can easily be understood without structural information. It is advisable to omit specifying aria-describedby if the dialog content includes semantic structures, such as lists, tables, or multiple paragraphs, that need to be perceived in order to easily understand the content, i.e., if the content would be difficult to understand when announced as a single unbroken string.
Since it's not something that's required by the pattern, and there are reasons that it wouldn't be used, having a warning logged adds extra noise that can confuse developers into adding a description when it's not necessary.
Reproducible example
Basic modal example sandbox
Suggested solution
Only apply the aria-describedby attribute if a description is provided, and don't warn when a description isn't provided.
Your environment
| Software |
Name(s) |
Version |
| Radix Package(s) |
react-dialog |
1.1.7 |
| React |
n/a |
|
| Browser |
n/a |
|
| Assistive tech |
n/a |
|
| Node |
n/a |
|
| npm/yarn/pnpm |
n/a |
|
| Operating System |
n/a |
|
Bug report
Current Behavior
When a dialog is created without a description, there's a warning (in non-production environments) that there's a missing description (code reference):
Expected behavior
Creating a dialog without a description shouldn't have a warning.
In the APG dialog pattern,
aria-describedbyis optional, and there are legitimate reasons to not need it:Since it's not something that's required by the pattern, and there are reasons that it wouldn't be used, having a warning logged adds extra noise that can confuse developers into adding a description when it's not necessary.
Reproducible example
Basic modal example sandbox
Suggested solution
Only apply the
aria-describedbyattribute if a description is provided, and don't warn when a description isn't provided.Your environment
react-dialog