Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltips create each a separate dom node in body #370

Open
KraXen72 opened this issue Nov 23, 2021 · 4 comments
Open

Tooltips create each a separate dom node in body #370

KraXen72 opened this issue Nov 23, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@KraXen72
Copy link

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

@KraXen72 KraXen72 added the bug Something isn't working label Nov 23, 2021
@hperrin
Copy link
Owner

hperrin commented Nov 23, 2021

That's how they work. They are hoisted to the body element so they appear on top of all other elements.

@hperrin
Copy link
Owner

hperrin commented Nov 23, 2021

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.

@KraXen72
Copy link
Author

can't they just conditionally render to the body on hover? like only render when the bound element is hovered

@drewrygh
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants