This project demonstrates a bug in bits-ui where clicking a Popover.Trigger wrapped in a Tooltip.Trigger during the tooltip's delay phase causes the application to freeze for 5-10 seconds.
- Install dependencies:
npm install- Start the dev server:
npm run dev- Open your browser to
http://localhost:5173
- Load the app and look at the sidebar on the left
- Find the User Menu button at the bottom of the sidebar
- Hover over the button to start the tooltip delay (150ms)
- Before the tooltip appears (within 150ms), click the button to open the dropdown
- Observe: The app freezes for 5-10 seconds
The dropdown should open immediately when clicked.
The app freezes for 5-10 seconds before the dropdown appears.
- Svelte: 5 (latest)
- SvelteKit: 2 (latest)
- bits-ui: ^2.14.4
- TypeScript
- Tailwind CSS
The bug occurs when a Popover.Trigger passes props to a button wrapped in Tooltip.Trigger:
<!-- In +layout.svelte -->
<Popover.Root bind:open>
{#snippet children(open)}
<Popover.Trigger>
{#snippet child({ props })}
<SidebarMenuButton {...props} tooltipContent="User Menu">
<!-- content -->
</SidebarMenuButton>
{/snippet}
</Popover.Trigger>
<Popover.Content><!-- menu items --></Popover.Content>
{/snippet}
</Popover.Root>
<!-- Inside SidebarMenuButton component -->
<Tooltip.Root disableHoverableContent delayDuration={150}>
<Tooltip.Trigger>
{#snippet child({ props: tooltipProps })}
<button {...tooltipProps} {...restProps}>
<!-- restProps includes the popover trigger props -->
</button>
{/snippet}
</Tooltip.Trigger>
<Tooltip.Content>User Menu</Tooltip.Content>
</Tooltip.Root>The freeze likely occurs when:
- Tooltip (bits-ui) manages one layer of focus/portal
- Popover (bits-ui) tries to open during tooltip delay
- Both components compete for focus management causing the freeze
/src/routes/+layout.svelte- Main layout with custom sidebar and popover menu/src/lib/components/sidebar-menu-button.svelte- Wrapper component that adds tooltip to buttons (where the bug manifests)/src/routes/+page.svelte- Home page with bug reproduction instructions/src/routes/about/+page.svelte- About page with technical details
- The freeze only occurs when clicking during the tooltip's delay period
- The interactive counter on the home page can be used to verify if the app is frozen
- Navigation between pages works normally