kobalte icon indicating copy to clipboard operation
kobalte copied to clipboard

Using `forceMount` on the tooltip leaves dangling `div`s in the DOM

Open andi23rosca opened this issue 6 months ago • 3 comments

Describe the bug Using forceMount on the tooltip leaves empty divs appended to the body, one for each individual tooltip instance. I'm observing it in conjunction with the presence util from solid-primitives

To Reproduce

  1. Install @solid-primitives/presence
  2. Create a presence instance based on a controlled signal for the tooltip
const presence = createPresence(open, {
    transitionDuration: 100,
 });
  1. Set the forceMount prop to: <Tooltip forceMount={presence.isMounted()} />
  2. Observe that hovering over the trigger and leaving it, will result in an empty div at the end of the body

Expected behavior Container div's should be disposed of like when the forceMount isn't being used

Screenshots The empty divs of 2 tooltips. They get reused when I hover on each tooltip again.

Image

Desktop (please complete the following information):

  • OS: Macos
  • Browser Chrome
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

andi23rosca avatar Jun 29 '25 14:06 andi23rosca

Sounds like force mount signal true is being maintained. Would it be possible to see a minimally reproducible example? It is possible this is a bug with the presence util rather than kobalte.

I'll see to making a reproduction when time allows otherwise.

shayanhabibi avatar Oct 08 '25 01:10 shayanhabibi

Sounds like force mount signal true is being maintained. Would it be possible to see a minimally reproducible example? It is possible this is a bug with the presence util rather than kobalte.

I'll see to making a reproduction when time allows otherwise.

I don't think that's the case, I'll try to reproduce it when I get the chance without the presence But from what I remember, I was using the isMounted to also trigger some animations and those were working as expected

What's the best way to share a reproducible example, stackblitz?

Edit: Scratch that, I was using isVisible for the exit animation, will see if it's a presence issue

andi23rosca avatar Oct 08 '25 10:10 andi23rosca

Yeah, or even a small trivial snippet that can be run to show the issue. Sounds like a possible bug, and I'll try to narrow down the problematic code. Thank you!

shayanhabibi avatar Oct 08 '25 10:10 shayanhabibi