Shopify/polaris

[Tooltip] when `active` prop is `undefined`, tooltip still appears

Closed this issue · 1 comments

pt8o commented

Summary

When you pass a const whose value is undefined into the active prop of a <Tooltip>, the tooltip will appear even though it shouldn't.

Expected behavior

undefined is falsy so passing undefined to active should lead to the tooltip not showing.

Actual behavior

Image

Tooltip shows up a const with value undefined is passed into its active prop.

Steps to reproduce

Link to sandbox

  1. Hover on the text to show the tooltip

Are you using React components?

Yes

Polaris version number

13.9.0

Browser

Chrome

Device

MacOS

pt8o commented

Closing this because I suspect it's intended 🤔

Seems like undefined means defer to Tooltip's internal state i.e. show the tooltip on hover, hide on blur. Whereas passing in true/false is forcing the Tooltip's state from outside. I've fixed the place where I spotted this on web and will close this issue.