Fix single-pane split-drag drop zones and default a center drop to split - #3482
Closed
elb-comt wants to merge 2 commits into
Closed
Fix single-pane split-drag drop zones and default a center drop to split#3482elb-comt wants to merge 2 commits into
elb-comt wants to merge 2 commits into
Conversation
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.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, sobeginSplitDragfalls back to the whole<main>for its drop rect. In the inline single-pane layout<main>also contains the right secondary panel (a siblingreact-resizable-panelspanel), 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 theleftband (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 withdata-split-pane-idso 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.tsand 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
zones.test.tscase "splits a center zone when the workspace has a single pane"; existingdecideThreadDropcases are unchanged becausesinglePanedefaults tofalse.data-split-pane-idon 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.node_modulesinstalled here); CI should run the@bb/apptypecheck/test filters.Fixes #3481