Blueprint: Disable tooltips with empty content by default

Created on 24 Mar 2017  Â·  9Comments  Â·  Source: palantir/blueprint

There's no reason to show empty tooltips. I would prefer if Blueprint prevented me from shooting myself in the foot here:

image

If you agree @giladgray @llorca, I can send a PR

core enhancement help wanted

All 9 comments

How did you do that? content is required.

On Fri, Mar 24, 2017, 1:15 PM Adi Dahiya notifications@github.com wrote:

There's no reason to show empty tooltips. I would prefer if Blueprint
prevented me from shooting myself in the foot here:

[image: image]
https://cloud.githubusercontent.com/assets/723999/24312016/11fea9f4-10ad-11e7-933f-3dcf6d1e9d4c.png

If you agree @giladgray https://github.com/giladgray @llorca
https://github.com/llorca, I can send a PR

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/palantir/blueprint/issues/886, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAcXtgT0kGL_uj9VmocwvqbdGsG7kRP2ks5rpCR4gaJpZM4MouLE
.

Makes sense. Worth printing a warning to the console to explain why the tooltip isn't showing up, when this happens? Could also add an explanatory sentence to a prop description. I prefer the second approach I guess.

@giladgray pretty simple:

content={null}
content={undefined}
content=""
content="    "

Worth printing a warning to the console to explain why the tooltip isn't showing up, when this happens? Could also add an explanatory sentence to a prop description.

how about... both?

Worth printing a warning to the console to explain why the tooltip isn't showing up

No, please don't do that. Sometimes I have dynamic data and can't guarantee that it will be non-empty. The whole point of asking for this feature is so that I don't have to do the check for empty contents. Of course I could implement this on my own right now but I prefer Blueprint to handle it:

<Tooltip
    disabled={content == null || content === ""}
    content={content}
>

i'm not going to handle the whitespace string " " case cuz that's not technically empty.

also doing this only for Tooltip, not Popover.

Shouldn't it also check if the tooltip isOpen is true? It keeps showing the warning even if isOpen is false.

@alisabzevari that was fixed in 1.15.0 https://github.com/palantir/blueprint/issues/1000

Was this page helpful?
0 / 5 - 0 ratings

Related issues

havesomeleeway picture havesomeleeway  Â·  3Comments

tgreenwatts picture tgreenwatts  Â·  3Comments

shahzeb1 picture shahzeb1  Â·  3Comments

vinz243 picture vinz243  Â·  3Comments

brsanthu picture brsanthu  Â·  3Comments