Skip to content

Fix single-pane split-drag drop zones and default a center drop to split - #3482

Closed
elb-comt wants to merge 2 commits into
get-bb:mainfrom
elb-comt:fix/single-pane-split-drop-target
Closed

Fix single-pane split-drag drop zones and default a center drop to split#3482
elb-comt wants to merge 2 commits into
get-bb:mainfrom
elb-comt:fix/single-pane-split-drop-target

Conversation

@elb-comt

Copy link
Copy Markdown

What was wrong

In a single-pane workspace, dragging a thread from the sidebar onto the chat pane splits or replaces depending on whether the right panel is open. Root cause: the single-pane chat region has no data-split-pane-id, so beginSplitDrag falls back to the whole <main> for its drop rect. In the inline single-pane layout <main> also contains the right secondary panel (a sibling react-resizable-panels panel), so the zones are measured over chat + panel. With the panel open the visible chat is the left half of <main>, so the visual center lands in the left band (25% < 28%) and splits; with the panel closed the visual center is 50% and replaces.

Repro, root cause, and code permalinks: #3481.

What changed

  • apps/app/src/components/secondary-panel/SecondaryPanelLayout.tsx: tag the inline pane's chat region with data-split-pane-id so drops are measured against the pane that owns them. The tagged element is the chat column, which excludes the right panel. Behavior no longer depends on the right panel.
  • apps/app/src/lib/split-drag/zones.ts and the two sidebar drag hooks (useThreadRowSplitDrag, usePaneContentSplitDrag): when the workspace has exactly one pane, a center drop resolves to a split to the right instead of replace. Replace stays available via an edge drop, the pane cap, and clicking the thread.
  • apps/app/src/lib/split-drag/zones.test.ts: unit test for the single-pane center case.

No wire, CLI, or guide changes.

How you verified

  • Unit: new zones.test.ts case "splits a center zone when the workspace has a single pane"; existing decideThreadDrop cases are unchanged because singlePane defaults to false.
  • Manual against the running 0.42.1 UI (local server, Playwright): injecting the equivalent data-split-pane-id on the inline chat region and re-running a real sidebar drag gives panel-open center → Replace this chat, panel-open left → Split left, panel-closed center → Replace, panel-closed right → Split right. Before the fix, panel-open center → Split left.
  • I could not run the monorepo test suite locally (no node_modules installed here); CI should run the @bb/app typecheck/test filters.

Fixes #3481

AGENT GENERATED

A single chat pane was not tagged with data-split-pane-id, so
beginSplitDrag fell back to the whole <main> element for its drop rect.
In the inline single-pane layout <main> also contains the right secondary
panel, so the drop zones were measured over chat + panel: side drops were
unreliable and a center drop landed in the split band whenever the right
panel was open.

Tag the inline pane content (the chat column, which excludes the panel)
with data-split-pane-id so drops are measured against the pane that owns
them. Split/replace behavior is now independent of the right panel.
With one visible chat, the center of the pane is a replace zone, so
dragging a thread in from the sidebar replaced the open chat instead of
adding a pane. Replace is also reachable by clicking the thread, so make a
center drop create a split to the right when the workspace has one pane.
Edge drops keep choosing their own side.
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @elb-comt for the PR. This repo needs approval before a PR. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ) and explain what you want to open a PR for and why. A maintainer then adds you to the allow list. This PR now closes on its own. Reopen it or open a new one after approval.

@github-actions github-actions Bot closed this Sep 11, 2026
@elb-comt
elb-comt deleted the fix/single-pane-split-drop-target branch September 11, 2026 13:38
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.

Split-drag drop zones for a single pane are measured against <main>, so they change with the right panel

1 participant