Skip to content

[BUG] v5.8.1 Not properly linking dynamically loaded triggers when one does not exist on mount #951

@rshelnutt

Description

@rshelnutt

Describe the bug
@gabrieljablonski Just a follow-up issue on v5.8:

There is an issue when using data-tooltip-id, if a <Tooltip/> exists on the initial load, but a triggering element does not exist on the initial load; When trigger elements become available in a subsequent view, they will not trigger the connection with the initial loaded <Tooltip/>.

Version of Package
v5.8.1

To Reproduce
Live example can be seen here: https://stackblitz.com/edit/react-dhtxpv?file=src%2FApp.js

Expected behavior
Regardless of whether a triggering element exists on the initial load of the page, the connection should be maintained.

Desktop

  • OS: iOS
  • Browser: Chrome
  • Version: 110
  • Frameworks: React 18

Additional context
Note: If even just a single, dummy, triggering element (eg. <span data-tooltip-id="tooltip" data-tooltip-content="." />) is added to the DOM on initial load (but only inside a conditional statement, and not the immediate DOM? See example comments...), it actually resolves this issue with subsequent views.

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