You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this demo, I have a button that triggers a floating tooltip when mouse enter, and remove the tooltip when mouse leave. Obviously I want the onComputed() to run when the tooltip is showing. However, there doesn't seem to be an easy way to turn it off on-demand when the tooltip is hidden. As a result, you can see the console message keeps printing.
I know you mentioned in #8 that autoUpdate() is unavoidable when the tooltip is out of view. But what I'm asking is a way to completely reset the whole floating-ui back to before the first call to floatingContent().
Or is this request more appropriate for the upstream?
<scriptlang="ts">import{ createFloatingActions }from'svelte-floating-ui'letshowTooltip=falseconst[floatingRef,floatingContent]=createFloatingActions({onComputed({ placement, middlewareData }){if(!showTooltip){console.log('I dont want to see this')}},})</script><divstyle="overflow:auto; height: 500px; width:500px; border: 1px solid;"><divstyle="width:500px; height: 1200px; display:flex; align-items: center; justify-content: center;"><buttonon:mouseenter={()=>(showTooltip=true)}on:mouseleave={()=>(showTooltip=false)}use:floatingRef>Hello</button>
{#if showTooltip}<divstyle="position:absolute; border: 1px solid; padding:4px;"use:floatingContent>Tooltipisalongone</div>{/if}</div></div>
The text was updated successfully, but these errors were encountered:
Thank you! According to the type definition, UpdatePosition specifically doesn't take autoUpdate, right? I tested your snippet and it does not work.
On the other hand, if I update(onComputed: () => {}), it no longer executes the old real onComputed, but still, this empty function is executed hundreds of times every time user scrolls, which is suboptimal.
In this demo, I have a button that triggers a floating tooltip when mouse enter, and remove the tooltip when mouse leave. Obviously I want the
onComputed()
to run when the tooltip is showing. However, there doesn't seem to be an easy way to turn it off on-demand when the tooltip is hidden. As a result, you can see the console message keeps printing.I know you mentioned in #8 that
autoUpdate()
is unavoidable when the tooltip is out of view. But what I'm asking is a way to completely reset the whole floating-ui back to before the first call tofloatingContent()
.Or is this request more appropriate for the upstream?
The text was updated successfully, but these errors were encountered: