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] Enhancement - Tooltip should not display when there is no value for 'title'

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Sometimes the value for the ‘title’ could be calculated and may be set to null. In this instance the tooltip should not be shown.

Current Behavior

Tooltip is shown regardless of whether there is a value for ‘title’ or not

Steps to Reproduce

https://codesandbox.io/s/z65pow4773

I believe putting the following code here would resolve the issue:

if(this.props.title === null || this.props.title === undefined || this.props.title === "")
   return;

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
oliviertassinaricommented, Jan 3, 2018

I think that the propTypes should be stricter: https://github.com/mui-org/material-ui/blob/ddde3c93235f170d2781749a8907005fc12372eb/src/Tooltip/Tooltip.js#L439-L442 @SimplerSoftware Why rendering a Tooltip component if you are not going to use it? It’s inefficient.

2reactions
ThadeuLuzcommented, Jan 3, 2018

I agree that title prop should be required

@SimplerSoftware is there a good reason why you are not using the good old helperText prop or the FormHelperText in the TextField? Whats the advantage of using a tooltip?

If you really need it, you can simply fix your problem with a new component:

const ConditionalTooltip = ({ title, children }) =>
  title ? <Tooltip title={title}>{children}</Tooltip> : children;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tooltip should not display when there is no value for 'title ...
Sometimes the value for the 'title' could be calculated and may be set to null. In this instance the tooltip should not be...
Read more >
How to avoid tooltip to display when title is null or empty?
When we hover on element that has title it will show correctly but when we hover on element that do not have title,...
Read more >
167435 - Improve Tooltip display of long TITLE attribute values
Confirmed using FizzillaCFM/2002090608 on 10.1.5. The tooltip doesn't wrap until it horizontally fills the window. What I'd suggest is to, once tooltip width ......
Read more >
Tooltips in the time of WCAG 2.1 | Sarah Higley
The browser software may chose to display the title of the document as a preliminary to retrieving it, for example as a margin...
Read more >
How do I Update the Content in Jquery UI Tooltip in Realtime?
After a little digging, I discovered that it was because the tooltip widget stores the "title" attribute in another place (using .data("ui-tooltip-content".
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