Fix a crash when a sidebar workspace drag ends (from #20015)
Follow-up to #20015. That fix made sidebar workspace reorder work again, but it crashes when the drag ends over the sidebar.
Cause
In #20015, SidebarBonsplitTabWorkspaceDropView forwards draggingEnded(_:) to SidebarWorkspaceReorderDropView. That view doesn't override the method, and NSView doesn't implement draggingEnded: at runtime: NSView.instancesRespond(to: "draggingEnded:") is false. Swift still compiles the call because the optional NSDraggingDestination requirement is imported onto NSView, so at runtime it throws NSInvalidArgumentException: unrecognized selector. AppKit sends draggingEnded: to the last destination that responds to it, and the Bonsplit overlay does, so ending a row drag over the sidebar hits this path. A correctness review subagent found it after #20015 merged.
Fix
- For sidebar reorder drags, the overlay now ignores
draggingEndedinstead of forwarding it. That matches how things worked before #18837, when AppKit skipped the reorder view for this call. reorderDestinationis now typed asSidebarWorkspaceReorderDropView.
Tests
workspaceRowDragOverBonsplitOverlayStillReorders now also calls bonsplit.draggingEnded(sender). The test commit comes before the fix. On that commit the call throws. Neither result was run locally, because local xcodebuild tests aren't allowed here. Hosted CI provides the green result.
Changelog
- Fixed: Ending a workspace drag in the sidebar no longer crashes.
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes a crash when ending a workspace row drag over the sidebar. The Bonsplit overlay forwarded draggingEnded: to the reorder drop view, which doesn't implement it, so AppKit raised an unrecognized selector exception. The overlay now swallows the call for sidebar reorder drags, and reorderDestination is typed as SidebarWorkspaceReorderDropView.
Summary by CodeRabbit
- Bug Fixes
- Fixed an issue that could cause unexpected behavior when ending a drag while rearranging workspaces in the sidebar. Drag-end events are now handled by the visible drop target, while other drag interactions continue to work as before.