Skip to content

[BUG] The content and activeAnchor arguments in the render cb do not always refer to the same element #1138

Closed
@RedForest347

Description

@RedForest347

Bug description
I render the contents of the tooltip using the render prop of the Tooltip component
when quickly moving the cursor between two elements, situations arise when activeAnchor argument refers to one element and content argument contains data-tooltip-content from another element.

Version of Package
v5.25.0

To Reproduce
I used an example from here: https://github.com/ReactTooltip/react-tooltip/blob/master/docs/docs/examples/render.mdx

I only changed props of the Tooltip component:

<Tooltip
    id="my-tooltip"
    // delayShow={500}
    // delayHide={20}
    render={({ content, activeAnchor }) => {
        console.log('activeAnchor', activeAnchor, 'content', content);
        return (
            <span>
                {`The element #${content} is currently active.`}
                <br />
                Relevant attribute:
                {activeAnchor?.getAttribute('data-some-relevant-attr') || 'not set'}
                {content == 1 ? <><br />ddd</> : ''}
            </span>
        );
    }}
/>

Expected behavior
the data-tooltip-content attribute of the activeAnchor prop should be the same as the content prop

Screenshots
image

Desktop (please complete the following information if possible or delete this section):

  • OS: Windows 10 19045.3803
  • Browser chrome
  • Version 120.0.6099.110
  • Frameworks React 18.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugV6It might get fixed/merged before, but most likely only on V6's release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions