[Tooltip] displaying twice when used with SVG icon
See original GitHub issueIn order to have both a styled tooltip and an accessibility friendly icon I am using the Tooltip
component along with setting titleAccess
on the Icon
component, but now two tooltips appear when hovering over. I know that by removing titleAccess
from the icon component it will prevent this but then you have a poor accessibility experience.
import React from "react";
import CheckIcon from "@material-ui/icons/CheckCircle";
import { Tooltip } from "@material-ui/core";
export default class Demo extends React.Component {
render() {
return (
<Tooltip title="My tooltip">
<CheckIcon titleAccess="My tooltip" />
</Tooltip>
);
}
}
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Two tooltips appear when hovering over
Expected Behavior 🤔
Only one should appear
Steps to Reproduce 🕹
https://codesandbox.io/s/material-ui-tooltip-icon-forked-ox00e?file=/demo.js
Steps:
- Hover over icon for a few seconds
Context 🔦
Trying to have both a styled tooltip and an accessibility friendly icon so screen readers know what the icon represents.
Your Environment 🌎
See reproduction
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (10 by maintainers)
Top Results From Across the Web
React-tooltip displays twice when using MUI icon
While using the HelpIcon from @mui: import HelpIcon from '@mui/icons-material/Help'; import ReactTooltip ...
Read more >Label is announced twice for the Icons displayed on the alerts ...
Actual result: Label is announced twice. Refer to the below example: Error icons are announced as "Error, graphic, error". Root cause: Title attribute...
Read more >If You're Inlining SVG Icons, How Do You Deal With Unique ...
But now you include that SVG somewhere twice. Say you're in Rails… Now you'll have two elements on the page with the exact...
Read more >16854 – display title in tooltip onmouseover in SVG
This is because the symbol is not rendered (unlike a <g>). To solve this in the weather symbol file, I had to move...
Read more >Tooltip | Components - BootstrapVue
When triggered from hyperlinks that span multiple lines, tooltips will be centered. Use white-space: nowrap; on your <a> s, <b-link> s and <router-link> ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And that’s what I’m doing, it just loses us the convenience of simply using the icon directly. It’s frustrating to want to use the
Tooltip
control and then having to track down all of the places that usetitle
and fiddle with them when then have such different behavior. It makes for a very inconsistent DX.@cmacdonnacha I have updated my first comment with
undefined
instead ofnull
, it works the same way.