svelte-material-ui
svelte-material-ui copied to clipboard
Tooltips create each a separate dom node in body
Describe the bug Tooltips each create a separate dom node in body.
To Reproduce add a few tooltips see inspect element
Expected behavior tooltips should probably change only one element and reposition it or only as much as needed from a global tooltip pool. smui shouldn't fill up the document body with tooltips. either create them programatically with conditional rendering in svelte (if else or svelte:component) or atleast put them in some kind of wrapper so they dont' directly pollute document body
That's how they work. They are hoisted to the body element so they appear on top of all other elements.
If I were to use one element for all tooltips, Svelte would be very confused during destruction. It's already bad enough that I'm moving the element. Svelte often stumbles over that on hot module reloading.
can't they just conditionally render to the body on hover? like only render when the bound element is hovered
@hperrin bumping this with a related question. How are non-rich tooltips meant to clean up their hoisted body element, when the tooltip's containing component is destroyed? I'm seeing the destroy method get called, which looks like it leads to event listeners getting removed, but the hoisted mdc-tooltip element still hangs around. It seems like this could potentially lead to a memory leak. How are these meant to get destroyed?
I'm using the v7.0.0-beta-12 btw, but I've been seeing the same thing since at least beta-0.