-
Notifications
You must be signed in to change notification settings - Fork 842
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
[Meta][EuiTooltip] Flexibility, accessibility & guidelines #4040
Comments
Related #3024 I'm broadly +1 on all the ideas. Each of those would improve our tooltips. To add one more thing we could do, maybe just as usage guidelines in the docs right now, is to remind consumers that any and all content that's in the tooltip looses all structure so anything other than a naked string is probably better suited for something else (e.g., headings are lost, actions are practically unreachable). |
Here's a start on some good do's and don'ts: Don't: Put interactable content in a tooltip Don't: Hide important validation information behind a tooltip Don't: Put formatted text in the tooltip |
As a side note, some of the more a11y focused efforts here could also be pushed onto EuiPopover as well. |
Closing this as not planned due to the age of the issue and lack of owner. |
Flexibility
Currently, adding EuiTooltip can be a bit of a pain because you have to wrap your component with the EuiTooltip component, which creates a wrapping DOM element, which may not display as you need so you have to pass an
anchorClassName
to override the display...A couple of ways we can make adding tooltips easier and more flexible:
tooltipContent
prop that will automatically add the necessaryref
s to the component to position the tooltip against without having to create a wrapper. (Related: [Discuss] Allow buttons to accept tooltip props #2027)string
in which the tooltip's anchor wrapper would become focusable. (Related: Allow strings for EuiToolTip children #2292)title
tooltips. This would help us to add our own tooltips to truncated components without relying ontitle
which has questionable a11y support. (Related: Always set a title attribute when truncating text via CSS #1923, Discuss and document guidelines for using EuiTooltip vs thetitle
property #3588, Add an EuiTextTruncate component #4085)aria-label
, we could try to simplify this combination ofaria-label
andtitle
with a tooltip. So that the screenreaders appropriately give meaning to the icon while their textual description can also be given for mouse users. (Related: [Discuss] Ifaria-labels
are supplied, add them to thetitle
attribute as well? #2021)Accessibility
Following watching this presentation on the accessibility and overall useful "tips" for tooltips. My takeaways for EuiTooltip (understanding that tooltips in EUI are here to stay 😉 ):
✅ On focus
✅ No dismiss on timeout
❌ Touch/eye control devices
❌ Dismiss without moving “cursor”
❌ Tooltip content is hoverable
ESC
may not be ideal, it may be a good solution in addition to a close buttonGuidelines (added to docs in #5066)
Some additional bits we should add to doc guidelines for usage:
The text was updated successfully, but these errors were encountered: