-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: allow a node to be passed in as an IconButton label #643
Conversation
Preview branch generated at https://allow-react-node-icon-button-label.d1gko6en628vir.amplifyapp.com |
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 don't think this will work as implemented, see how we're also setting aria-label
below:
cauldron/packages/react/src/components/IconButton/index.tsx
Lines 78 to 83 in 9d2b7bb
useEffect(() => { | |
if (!disabled) { | |
return; | |
} | |
internalRef.current?.setAttribute('aria-label', label); | |
}, [disabled]); |
I think you're on the right track, but we also need the button to have an accessible name as well. Perhaps we should be using <Offscreen>
there instead of just using aria-label
.
@scurker Good catch. I missed the "disabled" scenario. |
Preview branch generated at https://allow-react-node-icon-button-label.d1gko6en628vir.amplifyapp.com |
This allows a node to be passed in as the label for an IconButton. Allowing a node to be passed in allows consumers to include things like screen reader-only content. (see the docs example in this PR)