fix(desktop): keep workspace activity popover anchored to its button
Links
- Issue: SUPER-3055
- Before/after page: https://app.superset.sh/page/super-3055-keep-the-workspace-activity-popover-anc-sjsxie
Summary
- The workspace activity popover (pull requests / pages) now stays anchored to its trigger button when the window or the split layout resizes, instead of staying at its old screen position.
- Removes the zero-height anchor span and its
activityPanelStorestate, which only existed to anchor this popover.
Why / Context
In floating mode (center area too narrow to dock the panel), the popover was anchored through a virtualRef to an invisible h-0 span that ActivityPanelAside put in the top-right pane, not to the button. floating-ui's layout-shift observer returns early for references with no width or height, and the span never changes size, so its ResizeObserver never fires either. The window resize event did fire, but before the split layout settled. After that nothing repositioned the popover, so it drifted 174px off the button on a 1920→1500 resize and overshot by 162px on the way back (numbers on the page above).
How It Works
WorkspaceActivityMenu: the trigger button is wrapped in<PopoverAnchor asChild>, so Radix/floating-ui track the real button.sideOffsetgoes back to the default 4px, because the popover now sits under the button rather than under an offset span.ActivityPanelAside,activityPanelStore,constants: drop the anchor span,anchorNodes/setAnchorNode/clearAnchorNode, andPANEL_TOP_GAP_PX.
Docked mode (panel in the pane aside) is untouched.
Manual QA Checklist
Desktop dev build in this workspace, driven over CDP with real mouse input and X11 window resizes. Same script before and after:
- Workspace with a terminal and the right pane open → open the popover. It opens 4px under the button, right edges aligned (before: 88px lower, under the pane header).
- Resize the window 1920→1500px with the popover open. It follows the button (offset 0; before: 174px).
- Resize 1500→1920px. Still flush (before: −162px).
- Rapid oscillation 1400/1800/1300/1920/1500/1700/1920px at 250ms. Ends flush, and no
console.errorfired. - Clicking the button again closes the popover; the tooltip still shows on hover.
- Right pane closed at 1920px → the docked panel still renders in the aside.
- Deterministic repro with no window resize: popover open, then
Ctrl+Shift+B(toggle workspace sidebar). Base (parent commit's files, hot-reloaded): button moves to x=1165 and the popover stays at x=1250, 85px off. Fix: offset 0, and it stays 0 when the sidebar is shown again. The window-resize drift depends on timing (it needs the split layout to re-settle after theresizeevent), but any layout change that fires noresizeevent reproduces it every time. The reported recording shows this case: the right pane closes while the popover is open.
Design Decisions
- Anchor to the button, not the docked card's spot. #8975 put the anchor span where the docked card sits on purpose, so the floating popover opened in the same place. This PR drops that: the floating card now opens under its button and covers the pane's agent-launcher row while open. SUPER-3055 asks for this ("anchored on the button / react to resizes"). If the docked-spot placement should stay, the alternative is a non-zero-size span (e.g.
h-px) that floating-ui can track. That alternative was not tested.
Testing
bun run typecheck(apps/desktop)bunx biome checkon the changed filesbun test .../WorkspaceActivityMenu(14 pass)
No unit test added. The bug lives in floating-ui's live layout tracking, which bun's DOM-less tests can't exercise, so the CDP repro is the regression check.
Summary by cubic
Fixes the workspace activity popover drifting up to ~174px when the window or split layout resizes, by anchoring it to the trigger button instead of an invisible zero-height span.
- The popover previously anchored to a
h-0span in the right pane viavirtualRef; floating-ui skips zero-size references, so the popover kept stale coordinates after the first resize. - The trigger button is now wrapped in
PopoverAnchor asChild, and the popover sits 4px below it via the defaultsideOffset. - Removed the anchor span, the
anchorNodesstore state, andPANEL_TOP_GAP_PX; docked panel mode is unchanged.
Summary by CodeRabbit
- Updates
- The workspace activity menu is now anchored directly to its trigger button. Its displayed content and behavior remain unchanged, while the explicit spacing offset has been removed.
- The activity panel’s attachment and visibility behavior remain unchanged.