Skip to content

[BUG] Tooltip with no content is still shown #1120

@yriklin

Description

@yriklin

Bug description
A tooltip is displayed even when its contents are null or undefined.
In our case, we have a react-simple-maps component, and when the users hover over countries, only for countries with data should the tooltip be displayed.

Version of Package
5.22.0

To Reproduce
Import the Tooltip component from react-tooltip and use it as follows:

<Tooltip> {tooltipData ? renderTooltipData() : null} </Tooltip>

Change the state of tooltipData, and see that when it's null, an empty tooltip is displayed.

Expected behavior
If tooltipData is null or undefined, the tooltip should not be displayed.

Screenshots
image

Additional context

  1. The bug is not reproduced on version 5.21.7.
  2. React version we use: ^17.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions