Skip to content

The agent that grows with you

fix(desktop): keep submenus pinned to their trigger during scroll

Hermes Agentfaf9231bc29d
diff --git a/apps/desktop/src/components/ui/dropdown-menu.tsx b/apps/desktop/src/components/ui/dropdown-menu.tsx
index 85215c852b6..0937f6c08a3 100644
--- a/apps/desktop/src/components/ui/dropdown-menu.tsx
+++ b/apps/desktop/src/components/ui/dropdown-menu.tsx
@@ -487,6 +487,12 @@ function DropdownMenuSubContent({
// `overflow` clip. Radix Popper still anchors it to the SubTrigger and
// handles collision/flip. React events still bubble through the portal, so
// the parent menu doesn't treat a press here as an outside click.
+ //
+ // `updatePositionStrategy="always"` makes Floating UI's autoUpdate use a
+ // continuous rAF loop instead of the default "optimized" passive scroll
+ // listeners. Without it, a portaled submenu visibly lags behind its trigger
+ // while the parent Content scrolls: the scroll → getBoundingClientRect →
+ // reposition pipeline cannot keep pace with fast wheel events.
<DropdownMenuPrimitive.Portal container={container}>
<DropdownMenuPrimitive.SubContent
// Fixed `max-h-80` rather than the Radix available-height variable:
@@ -516,6 +522,10 @@ function DropdownMenuSubContent({
// first (child effects run first), so Radix marks it `none`.
style={{ ...(container ? { pointerEvents: 'auto' } : null), ...style }}
{...props}
+ // Placed after the spread so callers cannot override it: the rAF loop
+ // is load-bearing for scroll-tracked submenus and must never revert to
+ // the default passive-listener strategy.
+ updatePositionStrategy="always"
/>
</DropdownMenuPrimitive.Portal>
)