Skip to content

fix(view): stop portal pointer events from bubbling to view tab dnd#3233

Open
FQFangQi wants to merge 1 commit into
teableio:developfrom
FQFangQi:fix/view-tab-drag-portal-pointer-bubble
Open

fix(view): stop portal pointer events from bubbling to view tab dnd#3233
FQFangQi wants to merge 1 commit into
teableio:developfrom
FQFangQi:fix/view-tab-drag-portal-pointer-bubble

Conversation

@FQFangQi
Copy link
Copy Markdown

@FQFangQi FQFangQi commented May 25, 2026

Summary

Fixes a bug where dragging inside a view tab context menu or share dialog incorrectly triggered dnd-kit reordering on the view tab strip.

Radix ContextMenu and Dialog render content in a portal, but React synthetic events still bubble through the component tree to ancestors. View tabs attach dnd-kit listeners on a wrapper around ViewListItem, so pointer events from portaled overlays activated tab drag.

Changes

  • Stop pointerdown / mousedown propagation on ContextMenuContent, ContextMenuSubContent, DialogOverlay, and DialogContent
  • Disable view tab drag listeners while the view context menu is open (ViewList / ViewListItem)

Test plan

  • Right-click a view tab, drag inside the context menu — tabs should not reorder
  • Open share dialog from context menu or toolbar, drag on overlay/content — tabs should not reorder
  • Drag view tabs directly (without open overlays) — reordering still works
  • Rename / lock view / share actions in menus still work

Radix ContextMenu and Dialog content render in a portal but React
synthetic events still bubble to ancestors. That activated dnd-kit
listeners on the draggable view tab strip when dragging inside menus
or share dialogs. Stop pointer/mouse down propagation on overlay and
content, and disable tab drag listeners while the view context menu is open.

Co-authored-by: Cursor <cursoragent@cursor.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 25, 2026

CLA assistant check
All committers have signed the CLA.

@FQFangQi
Copy link
Copy Markdown
Author

Demo: before vs after

Before (bug) — dragging inside the context menu / share dialog incorrectly reorders view tabs:

20260526102751_rec_

After (fixed) — same steps on branch fix/view-tab-drag-portal-pointer-bubble; tabs no longer follow pointer inside overlay/menu:

20260526104401_rec_

What changed

  • Stop pointerdown / mousedown propagation on portaled ContextMenu / Dialog surfaces.
  • Disable view-tab dnd listeners while the view context menu is open.

Verification (local)

  • Drag inside view context menu → tabs do not move
  • Drag inside share dialog overlay/content → tabs do not move
  • Drag view tabs directly (no overlay) → reorder still works
  • Menu actions (rename / lock / share) still work
    Thanks for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants