Fix sidebar workspace reorder by drag (regressed in #18837)

Merged
AU
4d ago
+94-1

Dragging a workspace in the vertical sidebar no longer reordered it. Caused by #18837 (48ba2090321, "Drop a sidebar workspace onto a pane to merge its tabs").

Cause

#18837 added the Bonsplit tab drag type to every sidebar row drag, so pane drop targets could treat the row as a merge. AppKit sends a drag to the frontmost view that is registered for one of its types and contains the pointer. It does not consult hitTest (see CloudSurfaceDropGateView.swift). In SidebarWorkspaceTableContainerView, bonsplitDropView is a full-size view stacked above reorderDropView and registered for that Bonsplit type. After #18837 it received every row drag. BonsplitTabDragPayload.transfer returns nil for a sidebar reorder pasteboard (also #18837), so the overlay rejected the drag, and the reorder view beneath never saw it.

The other suspects don't touch this path. #18303 and #18693 change the Cloud tree outline, and #19593 is a Bonsplit submodule bump for tab-bar motion.

Fix

SidebarBonsplitTabWorkspaceDropView now forwards dragging callbacks for sidebar reorder drags (pasteboard has SidebarTabDragPayload's type) to the container's reorderDropView. Bonsplit tab drags from panes keep their existing handling. Merge-onto-pane from #18837 is unchanged: pane destinations still read the row's merge capability, and inside the sidebar the reorder wins.

Tests

SidebarWorkspaceReorderDropOverlayHitTestingTests.workspaceRowDragOverBonsplitOverlayStillReorders builds the real container and checks that the Bonsplit overlay is the frontmost registered destination for a row drag carrying both types. It then drives entered, updated, prepare, perform and conclude on that overlay and expects the reorder view's update and drop callbacks to fire. The test was committed before the fix (dc42c54e7fb). On that commit the overlay returns [] because the transfer is nil. Neither red nor green was run locally (local xcodebuild tests are not allowed), so hosted CI gives the green result.

Changelog

  • Fixed: Dragging a workspace in the sidebar reorders it again.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes dragging a workspace in the sidebar to reorder it, which regressed in #18837.

#18837 made every sidebar row drag carry the Bonsplit pane-merge type, so AppKit routed those drags to the frontmost registered destination—the full-size Bonsplit overlay—which rejected them, and the reorder view beneath never saw them. The Bonsplit overlay now forwards sidebar reorder drags to the reorder view, while dropping a row onto a pane still merges its tabs.