Closed
Description
Package
@carbon/react
Browser
No response
Package version
1.80.0
React version
18.3.1
Description
When using a custom Button component that wraps Carbon’s Button inside a Callout, an accessibility error is thrown in Storybook:
Error: interactive child node(s) should have an `aria-describedby` property with a value matching the value of `titleId`.
Even though I pass aria-describedby explicitly to the custom Button, the rendered output seems to ignore or overwrite it.
Reproduction/example
https://stackblitz.com/edit/github-1qhjyknb?file=src%2FApp.tsx
Steps to reproduce
-
Create a wrapper component around Carbon’s and pass aria-describedby as a direct prop (not via ...rest).
-
Use this custom Button inside a Carbon component that also defines a title and titleId.
-
Pass the titleId as the value for aria-describedby in the Button:
const titleId = useId();
<Callout title="Alert Title" titleId={titleId}>
<Button
aria-describedby={titleId}
iconDescription="Close alert"
hasIconOnly
/>
</Callout>
4.Render this component.
- Observe the console.
Suggested Severity
None
Application/PAL
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
- I checked the current issues for duplicate problems
Metadata
Metadata
Assignees
Type
Projects
Status
✅ Done