-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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
Tooltip: Ensure tooltip text is correctly announced by screenreaders #76683
Conversation
Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com> Co-authored-by: joshhunt <josh@trtr.co>
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.
supportive of this 👍🏻
would like to test, especially with IconButton. I think there might be some automatic aria-label behaviour we can remove from it now.
@joshhunt tested removing the not sure how to solve that really 🤔 |
@ashharrison90 before you removed aria-label from IconButton, are screen readers double announcing the tooltip content? What's the impact of "doing nothing" for IconButton? Maybe we could force (uncontrolled?) tooltips open when running in unit tests? 😬 Or, in Tooltip we could hackily inspect the props of the children trigger and not apply aria-describedby if it has an aria-label? |
@joshhunt yeah it double announces the tooltip content
i think having a label present always might be useful in the actual product though. if you know you want to find a certain button immediately on a page, you don't want to have to tab through every button until you find it.
this was my initial thought tbh. i'm not sure if it's that bad... i would kind of expect an |
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.
Tested this and I think it's a good improvement.
Specifically though, this doesn't resolve the issue with the dashboard permissions page where it puts a Tooltip on an Icon
<Tooltip content="Here's some access control info">
<Icon name="info-circle" />
</Tooltip>
This is reproducable in storybook with this markup. Haven't digged into it further yet, but perhaps aria-describedby cannot be put on a div? Maybe it only goes on interactive elements?
I think this kind of checks out - you would normally put an aria-label on an icon, so perhaps for <Tooltip><Icon /></Tooltip>
aria-labelledby makes more sense? Unsure the best way to resolve this.........
@joshhunt good spot! i don't know why tbh. looking at the tooltip spec, all it says is that the tooltip should have and looking at the docs for either way i'll merge for now and we can discuss best approach going forward. |
actually @joshhunt if we set |
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 is this feature?
aria-describedby
to the tooltip triggertooltip
role to the tooltipdelayShow
as this prevents the tooltip text being announced correctly by screenreaders (see https://raintank-corp.slack.com/archives/C025WTVRBSN/p1697541819161599 for context)Why do we need this feature?
Who is this feature for?
Which issue(s) does this PR fix?:
For #57207
Special notes for your reviewer:
Please check that: