-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(tooltip): add aria-labelledby #3011
Conversation
Deploy preview for the-carbon-components ready! Built with commit e71dcaa https://deploy-preview-3011--the-carbon-components.netlify.com |
Deploy preview for carbon-components-react ready! Built with commit e71dcaa https://deploy-preview-3011--carbon-components-react.netlify.com |
Deploy preview for carbon-elements ready! Built with commit e71dcaa |
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.
shouldn't aria-label
also support taking the value from the user setting the attribute directly?
Confirmed DAP does not have any violations. |
If they wanted to specify an aria-label wouldn't they be doing that via |
right but since |
Oooh I see. Okay, thanks for clearing that up! |
Unless I'm wrong here it seems like if the user doesn't provide a custom ID for the tooltip, we generate one for them, and then all we do with it is set it to our @snidersd Since the |
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 think it's fine to remove the id generator for definition tooltip. seems it was carried over from the interactive tooltip? but the two tooltips are built differently
return { 'aria-labelledby': triggerId }; | ||
} | ||
// if the user provides neither of those set aria-label to icon-description | ||
return { 'aria-label': iconDescription }; |
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.
how are you getting iconDescription
here?
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.
Hey, getting back to this now. :D That's just a prop. Are you thinking it should be required if we don't have either ariaLabel
or triggerText
?
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.
what I mean is it looks like it's undefined. you would need to get the value from this.props.iconDescription
first
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.
Seems great after @emyarod's suggestions 👍
@dakahn I'm only seeing a DAP issue with the TooltipDefintion and the TooltipIcon. However, the Tooltip, which is actually a Modal does not restrict tab focus to the modal. |
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.
the DAP issues are for TooltipDefinition
and TooltipIcon
only right? and the issue for the interactive tooltip is the lack of a focus trap? I'm still seeing all of these issues unless this PR is addressing something different
@dakahn do we want to get this in for 10.4 or should we close/revisit it at a later time? |
This isn't 2.4 -- seems like this devolved into weird unnecessary refactor work. I'll address #2736 in another PR 😕 |
Closes #2736
Updates Tooltip. If a the user provides a
triggerText
proparia-labelledby
is set to that id -- if they don't we setaria-label
toiconDescription
.Changelog
aria-describedby
witharia-labelledy
on l372.cc @emyarod @snidersd, I know you were working in this space and want to make sure I have #2736's intent right.