Repository navigation
feat(fork): split the right panel by dragging a tab - #164
Open
orbitingflea wants to merge 2 commits into
Open
orbitingflea wants to merge 2 commits into
orbitingflea wants to merge 2 commits into
Conversation
A click on a right-panel tab's padding or its top and bottom edges does nothing, a click with a few pixels of hand movement is swallowed by the tab drag sensor, and a working click switches only after mouse-up. This browser test presses a tab's edges and its label with jitter and checks that the tab is active before the button is released, that focus stays where the switch put it, that touch and keyboard switch on click, and that the close button closes without switching. It fails on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drag a right-panel tab onto the outer third of the panel content: a box shows the half the new pane will take, and the drop splits the panel into two side-by-side panes, each with its own tab strip, as with Windows Snap. Tabs move between panes by drag or the tab menu (Split right, Split left, Move to the other pane, Unsplit). A splitter resizes the panes. Closing or moving away a pane's last tab ends the split. New tabs open in the focused pane. A narrow panel shows all tabs in one strip and keeps the split for later. A new split widens a narrow panel and gives the width back when it ends. The layout is one optional field on the panel's per-thread record, kept valid by one reconcile step in the store's write path, so the existing pane-blind open and close calls keep working. The logic lives in apps/web/src/fork/rightPanelSplit/. Tabs also switch on a primary press anywhere on the tab instead of on a click on the title text, so edge clicks and clicks with hand movement no longer miss, and the switch runs while the button is still held. Touch and keyboard switch on click; a touch drag needs a short hold so a swipe scrolls the strip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This PR changes the test suite by +27 test cases (browser +8, unit +19, server 0). New browser test files: Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing. |
This branch has not been deployed
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.
This pull request lets a user split the right panel into two panes by dragging a tab, and makes a press anywhere on a tab switch to it at once.
改了什么行为
Behaviour change: yes, a web or desktop user who drops a right-panel tab on the left or right third of the panel's content gets two side-by-side panes, each with its own tabs, and a press anywhere on a tab outside its close and mute buttons now switches to it.
Why
Users asked for a split like Windows Snap, started by dragging a tab. They also reported tab clicks that switched late or not at all. Only the title text took a click, 6 px of hand movement turned the click into a drag, and the switch waited for mouse-up.
Checks
A new browser test presses a tab's edges and presses with hand jitter. It fails on
mainand passes now. New tests cover the split state, the drop targets and the split view, and the repo's checks for changed files pass. In the web app at desktop and phone width, tab presses, drag to split, moving tabs, the splitter, reload and the narrow layout worked. The desktop app was not run.How to undo
Revert the two commits. No server, wire or database change. Older code runs its migration on the stored panel version 15, which drops the split.
Design notes
ThreadRightPanelStategets one optionalsplitfield withrightIds,otherShownIdandratio.surfacesstays the one list of tabs, the left pane's first. The focused pane is the one that holdsactiveSurfaceId, so code that reads the active tab keeps working. The stored version goes from 14 to 15 with a migration, and a persistmergerepairs a damaged split at the same version. A reload keeps the split.updateThreadStateMappasses every write throughreconcileSplitwith its kind (user, close or automatic). New tabs join the focused pane. A replacement that empties a pane, such as a folder tree that becomes a file, fills that pane. A close falls back to a neighbour in its own pane. When a pane empties, the split ends.updateSplit(ref, change)is the one layout action.RightPanelSplitView, with one pane or two. The left pane keeps its React identity, so a split does not remount what it shows. The Pull requests page has no split but gets the new tab press.pointerdownactivates a tab, before the 6 px drag threshold. Close, mute and rename do not activate, and middle-click and right-click do not switch. Touch and keyboard activate on click. A touch drag needs a 250 ms hold, so a swipe scrolls the strip.apps/web/src/fork/rightPanelSplit/. Upstream files:ChatView.tsx+72 −60 (mostly a re-indent),RightPanelTabs.tsx+61 −30,RightPanelTabs.browser.test.tsx+98,rightPanelStore.ts+34 −9,useRightPanelSurfaceClose.ts+14 −11,ChatRightPanel.tsx+9 −4,useChatTerminalActions.ts+8 −4,usePreviewPanelInlineSize.ts+5 −2,PreviewPanel.tsx+4,PreviewView.tsx+4 −2,PullRequestGuideTab.tsx+4 −1,RightPanelSurfaceContent.tsx+2 −1,PullRequestDetailPanel.tsx+1. Without whitespace, all upstream files come to +262 −70.README.mdgets one line.