-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tooltip] Don't show if title is undefined
, null
or false
#29696
Comments
undefined
or null
undefined
, null
or false
It makes sense. However, there could be applications that rely on the existing behavior, so I'd propose waiting for v6 with such a change. A workaround, for now, would be to fall back to an empty string if a value is nullish or false: function BetterTooltip(props) {
return <Tooltip {...props} title={(props.title != null && props.title !== false) ? props.title : '')} />
} |
undefined
, null
or false
undefined
, null
or false
Hi @michaldudak I can't imagine how any application could use such a weird empty rudiment of tooltip as you see on screenshot. |
Perhaps not exactly what's on the screenshot, but custom styled version. Your proposal, while being perfectly valid, touches the public API that should not change between major versions. |
This issue feels almost like a duplicate of #9714. On that older issue, the argument was made that not accepting, null, undefined, or false as valid Now, if this issue is about keeping the prop-type error and keeping the TypeScript failure when a non-displayable title is provided, then 馃憤. Not showing the invalid title would lead to a better fallback UX for end-users and keep a good DX for developers when the |
Duplicates
Latest version
Summary 馃挕
Tooltip shouldn't be shown if title property is
undefined
,null
or booleanfalse
.Currently only explicit empty string works and for
null
/undefined
/false
empty screwed tooltip is still show,Examples 馃寛
https://codesandbox.io/s/basictooltip-material-demo-forked-zy0vq?file=/demo.js
Motivation 馃敠
It's a common approach in React to not render undefined / null / false element, same expected from tooltip.
The text was updated successfully, but these errors were encountered: