[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:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top 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 >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
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.
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: