question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Tooltip] displaying twice when used with SVG icon

See original GitHub issue

In 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:

  1. 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:open
  • Created 2 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
ggascoignecommented, Jun 7, 2021

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 use title and fiddle with them when then have such different behavior. It makes for a very inconsistent DX.

1reaction
oliviertassinaricommented, Apr 22, 2021

@cmacdonnacha I have updated my first comment with undefined instead of null, it works the same way.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found