fix(Dialog): Suppress Missing Description Warning#976
Conversation
… provided
Radix warns when DialogContent has no DialogDescription rendered.
Now renders a hidden RadixDialog.Description by default so the
warning is suppressed without requiring consumers to pass a
description prop or aria-describedby={undefined}.
🦋 Changeset detectedLatest commit: 120f039 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 |
|
Claude finished @dustinhealy's task in 1m 30s —— View job PR Review
The fix is minimal and solves the stated problem effectively. Good changeset included. A couple of things worth noting: ♿ Accessibility — minor nuance
A slightly cleaner alternative that avoids the 🧪 Tests — no new coverage for the fix The existing test at line 48 ( // Dialog.test.tsx — suggested addition inside the "no title" test
fireEvent.click(screen.getByText('Open Dialog'));
const hiddenDesc = document.querySelector('[data-radix-ui-dialog-description]')
?? document.querySelector('[id*="radix-"]'); // adjust to actual rendered selector
expect(hiddenDesc).toBeTruthy();Overall this is a clean, well-scoped fix with proper changeset. The a11y note is informational rather than blocking. |
📚 Storybook Preview Deployed✅ Preview URL: https://click-v2sfiqllq-clickhouse.vercel.app Built from commit: |
… provided (#976) Radix warns when DialogContent has no DialogDescription rendered. Now renders a hidden RadixDialog.Description by default so the warning is suppressed without requiring consumers to pass a description prop or aria-describedby={undefined}.
Why?
When
Dialog.Contentis used without adescriptionprop, Radix logs a console warning:Passing
aria-describedby={undefined}from the consumer side doesn't work because styled-components stripsundefinedprops before they reach Radix's internalDialogContent.How?
Renders a hidden
<RadixDialog.Description hidden />when nodescriptionprop is provided. This satisfies Radix's accessibility check without any visible UI change.When
descriptionIS provided, the visible<Description>component renders as before.Tickets?
Contribution checklist?