fix(files): anchor editor bubble menus to the selection on scroll - #6419
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Introduces shared Removes duplicated anchor logic and prior viewport-clamp workarounds from Reviewed by Cursor Bugbot for commit eb50d71. Configure here. |
Greptile SummaryThe PR centralizes text and table bubble-menu anchoring in a shared hook, binds TipTap repositioning to the editor’s inner scroll container, and enables hiding when the selection leaves the clipping area.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/bubble-menu.tsx | Replaces inline text-menu anchoring and Floating UI configuration with the shared positioning hook. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/table-menu.tsx | Replaces table-specific anchor clamping with the shared scroll-aware positioning hook. |
| apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/use-bubble-menu-floating.ts | Adds the shared live selection anchor, scroll-target options, hide middleware, and body portal configuration. |
Reviews (2): Last reviewed commit: "fix(files): anchor the editor bubble men..." | Re-trigger Greptile
The text and table bubble menus stayed pinned to a viewport position when the file scrolled — clicking a table cell then scrolling left the toolbar floating over unrelated content. TipTap v3's BubbleMenu reposition listener defaults to `window`, but the editor scrolls inside an inner overflow container, so it never fired; the menu only moved when the selection itself changed. Pass the editor's scroll container as the BubbleMenu `scrollTarget` (a first-class TipTap option) so it repositions with the selection, and enable Floating UI's `hide` middleware so the menu hides once its anchored cell scrolls out of view. Share the anchor + options through one `floating-anchor` helper so the two menus can't drift. Removes the prior workarounds that fought this: the `strategy: 'fixed'` viewport-pin, the resolveAnchor viewport-clamp branches, and the bubble menu's selection-keyed rect cache (which froze the menu in place on scroll). Verified in a harness: on scroll the menu delta matches the cell delta (follows), and it hides once the cell leaves view.
241933e to
eb50d71
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit eb50d71. Configure here.
Summary
@tiptap/extension-bubble-menudoesn't use Floating UIautoUpdate; it repositions via a manualscrolllistener whose target defaults towindow. The editor scrolls inside an inneroverflow-y:autocontainer, so that listener never fires — the menu only moved when the selection changed.scrollTarget(a first-class TipTap option) so it repositions with the selection, and enable Floating UI'shidemiddleware so the menu hides once its anchored cell scrolls out of view. Both menus now share onefloating-anchorhelper (anchor + options) so they can't drift.strategy: 'fixed'viewport-pin, theresolveAnchorviewport-clamp branches, and the bubble menu's selection-keyed rect cache (which froze the menu in place on scroll). Net −60 lines.Type of Change
Testing
visibility: hiddenonce the cell scrolls out of view.Checklist