Skip to content

Commit adb05e7

Browse files
authored
improve(control-ui): move the split-view opener into the top-right toggle cluster (#104341)
* improve(control-ui): move split-view opener into the top-right floating toggle cluster * test(control-ui): anchor split-view opener e2e assertions to the floating toggle cluster
1 parent 72cf43f commit adb05e7

10 files changed

Lines changed: 83 additions & 52 deletions

File tree

‎docs/web/control-ui.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ The macOS app keeps its native link-browser sidebar for links clicked in the das
311311
- The background tasks rail in each Chat pane lists the current agent's background tasks and subagents (`tasks.list` scoped by agent, kept live by `task` events): running work with a stop control, a collapsible finished section, and a View transcript link that opens the task's child session in the pane. Open it with the activity toggle in the split-pane header or the floating activity button in single-pane chat (both carry a running-count badge once loaded). The Tasks page remains the full cross-agent ledger.
312312
- The workspace rail and detail panel adapt to each pane's own width rather than the window: in a narrow pane or compact window the workspace rail always presents as a bottom strip (side-dock controls hide until the pane widens), and the detail panel stacks below the thread with a horizontal resize handle instead of sharing the row with it. Phone-sized viewports still open the detail panel full-screen.
313313
- The chat header model and thinking pickers patch the active session immediately through `sessions.patch`; they are persistent session overrides, not one-turn-only send options.
314-
- **Split view:** open it from the bottom-right page action, then split the active pane right or down for as many panes as fit. Each pane has its own session, transcript, composer, and tool stream.
314+
- **Split view:** open it from the top-right floating toggle row (beside the session diff, background tasks, and session files toggles), then split the active pane right or down for as many panes as fit. Each pane has its own session, transcript, composer, and tool stream.
315315
- Drag a session from the sidebar into chat to open it in a pane. An animated drop preview glides between zones and labels the outcome — "Split" over the exact half a new pane will occupy, "Open here" over a whole pane — and drops also work from single-pane mode.
316316
- The active split pane drives the sidebar selection and URL. Each pane carries its own header row with the session title plus workspace-rail, split, and close controls; dividers resize columns and stacked panes, and the browser stores the layout locally across reloads.
317317
- On narrow screens, split view keeps the layout but renders only the active pane, including its header with the close control.

‎ui/src/components/icons.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,12 @@ export const icons = {
626626
<path d="M8 10l3 2-3 2" stroke-linecap="round" stroke-linejoin="round" />
627627
</svg>
628628
`,
629+
columns2: html`
630+
<svg viewBox="0 0 24 24">
631+
<rect x="3" y="3" width="18" height="18" rx="2" />
632+
<path d="M12 3v18" stroke-linecap="round" />
633+
</svg>
634+
`,
629635
panelBottomOpen: html`
630636
<svg viewBox="0 0 24 24">
631637
<rect x="3" y="3" width="18" height="18" rx="2" />

‎ui/src/e2e/chat-composer-redesign.e2e.test.ts‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ describeControlUiE2e("Control UI chat composer redesign", () => {
129129
await expect.poll(() => settings.isVisible()).toBe(true);
130130
await expect.poll(() => splitView.isVisible()).toBe(true);
131131
await expect
132-
.poll(() =>
133-
splitView.evaluate((node) => node.closest(".agent-chat__composer-shell") == null),
134-
)
132+
.poll(() => splitView.evaluate((node) => node.closest(".chat-floating-toggles") != null))
135133
.toBe(true);
136134
await expect.poll(() => attach.isVisible()).toBe(true);
137135
await expect.poll(() => camera.isVisible()).toBe(false);
@@ -419,20 +417,22 @@ describeControlUiE2e("Control UI chat composer redesign", () => {
419417
expect(activeModelBox.x).toBeGreaterThanOrEqual(
420418
activeProgressBox.x + activeProgressBox.width - 1,
421419
);
420+
// The opener lives in the floating toggle cluster pinned to the
421+
// top-right corner of the chat area. The cluster's right edge hugs the
422+
// corner; the opener itself is the leftmost button in the row.
423+
const toggleClusterBox = await page.locator(".chat-floating-toggles").boundingBox();
424+
expect(toggleClusterBox).not.toBeNull();
425+
if (!toggleClusterBox) {
426+
throw new Error("expected the floating toggle cluster to have a layout box");
427+
}
422428
expect(
423429
Math.abs(
424430
activeChatContentBox.x +
425431
activeChatContentBox.width -
426-
(activeSplitViewBox.x + activeSplitViewBox.width),
427-
),
428-
).toBeLessThanOrEqual(24);
429-
expect(
430-
Math.abs(
431-
activeChatContentBox.y +
432-
activeChatContentBox.height -
433-
(activeSplitViewBox.y + activeSplitViewBox.height),
432+
(toggleClusterBox.x + toggleClusterBox.width),
434433
),
435434
).toBeLessThanOrEqual(24);
435+
expect(Math.abs(activeSplitViewBox.y - activeChatContentBox.y)).toBeLessThanOrEqual(24);
436436
expect(
437437
Math.abs(
438438
activeProgressBox.y +

‎ui/src/pages/chat/chat-page.test.ts‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type RenderedPane = HTMLElement & {
2323
showPaneHeader: boolean;
2424
paneTitle: string;
2525
narrow: boolean;
26+
onOpenSplitView?: () => void;
2627
};
2728

2829
function setLayout(page: ChatPage, layout: ChatSplitLayout | undefined) {
@@ -119,7 +120,20 @@ describe("chat page split layout host", () => {
119120
expect(panes[0].active).toBe(true);
120121
expect(panes[0].showPaneHeader).toBe(false);
121122
expect(page.querySelector("resizable-divider")).toBeNull();
122-
expect(page.querySelector(".chat-open-split-view")).toBeInstanceOf(HTMLButtonElement);
123+
// The pane renders the opener in its floating toggle cluster; the page
124+
// only hands down the callback on wide single-pane layouts.
125+
expect(typeof panes[0].onOpenSplitView).toBe("function");
126+
});
127+
128+
it("withholds the split-view opener on narrow single-pane viewports", async () => {
129+
stubMatchMedia(true);
130+
const page = new ChatPage();
131+
page.data = { sessionKey: "main" };
132+
document.body.append(page);
133+
await page.updateComplete;
134+
135+
const pane = page.querySelector<RenderedPane>("openclaw-chat-pane");
136+
expect(pane?.onOpenSplitView).toBeUndefined();
123137
});
124138

125139
it("hands each route-provided draft to the active pane only once", async () => {
@@ -166,7 +180,7 @@ describe("chat page split layout host", () => {
166180
expect(page.querySelector(".chat-split-view__cell--active")?.contains(panes[1])).toBe(true);
167181
// Panes own their in-flow header row (title + workspace/split/close).
168182
expect(panes.map((pane) => pane.showPaneHeader)).toEqual([true, true]);
169-
expect(page.querySelector(".chat-open-split-view")).toBeNull();
183+
expect(panes.every((pane) => pane.onOpenSplitView === undefined)).toBe(true);
170184
});
171185

172186
it("renders only the active pane from a preserved split on narrow viewports", async () => {

‎ui/src/pages/chat/chat-page.ts‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { property, state } from "lit/decorators.js";
44
import { repeat } from "lit/directives/repeat.js";
55
import { applicationContext, type ApplicationContext } from "../../app/context.ts";
66
import { loadSettings, patchSettings } from "../../app/settings.ts";
7-
import { icons } from "../../components/icons.ts";
87
import "../../components/resizable-divider.ts";
9-
import "../../components/tooltip.ts";
108
import { t } from "../../i18n/index.ts";
119
import { resolveSessionDisplayName } from "../../lib/session-display.ts";
1210
import { readSessionDragData, sessionDragActive } from "../../lib/sessions/drag.ts";
@@ -529,22 +527,9 @@ export class ChatPage extends OpenClawLightDomElement {
529527
.showPaneHeader=${false}
530528
.onFocusPane=${this.handleFocusPane}
531529
.onPaneSessionChange=${this.handlePaneSessionChange}
530+
.onOpenSplitView=${this.narrow ? undefined : this.openSplitView}
532531
></openclaw-chat-pane>
533532
`}
534-
${!this.layout && !this.narrow
535-
? html`
536-
<openclaw-tooltip .content=${t("chat.splitView.open")}>
537-
<button
538-
class="btn btn--sm btn--icon chat-open-split-view"
539-
type="button"
540-
aria-label=${t("chat.splitView.open")}
541-
@click=${this.openSplitView}
542-
>
543-
${icons.panelRightOpen}
544-
</button>
545-
</openclaw-tooltip>
546-
`
547-
: nothing}
548533
${indicator
549534
? html`<div
550535
class="chat-split-view__drop-indicator ${indicator.zone.kind === "center"

‎ui/src/pages/chat/chat-pane.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ class ChatPane extends OpenClawLightDomElement {
189189
@property({ attribute: false }) showPaneHeader = false;
190190
@property({ attribute: false }) paneTitle = "";
191191
@property({ attribute: false }) narrow = false;
192+
@property({ attribute: false }) onOpenSplitView?: () => void;
192193
@property({ attribute: false }) onSplitDown?: (paneId: string) => void;
193194
@property({ attribute: false }) onSplitRight?: (paneId: string) => void;
194195
@property({ attribute: false }) onClosePane?: (paneId: string) => void;
@@ -1406,6 +1407,7 @@ class ChatPane extends OpenClawLightDomElement {
14061407
sessionWorkspace,
14071408
backgroundTasks,
14081409
paneHeaderActive: this.showPaneHeader,
1410+
onOpenSplitView: this.onOpenSplitView,
14091411
taskSuggestions: this.taskSuggestions,
14101412
pullRequests: this.sessionPullRequests.filter(
14111413
(pullRequest) => !this.dismissedSessionPullRequestIds.has(chatPullRequestId(pullRequest)),

‎ui/src/pages/chat/chat-view.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,29 @@ describe("chat composer workbench", () => {
14741474
expect(onToggleCollapsed).toHaveBeenCalledTimes(1);
14751475
});
14761476

1477+
it("renders the split-view opener in the floating toggle cluster", () => {
1478+
const onOpenSplitView = vi.fn();
1479+
const container = renderChatView({ onOpenSplitView });
1480+
1481+
const cluster = container.querySelector(".chat-floating-toggles");
1482+
const opener = cluster?.querySelector<HTMLButtonElement>(".chat-open-split-view");
1483+
expect(opener?.getAttribute("aria-label")).toBe("Open split view");
1484+
1485+
opener?.click();
1486+
expect(onOpenSplitView).toHaveBeenCalledTimes(1);
1487+
});
1488+
1489+
it("hides the split-view opener while the detail sidebar is open", () => {
1490+
const container = renderChatView({
1491+
onOpenSplitView: () => undefined,
1492+
sidebarOpen: true,
1493+
sidebarContent: { kind: "markdown", content: "detail" },
1494+
onCloseSidebar: () => undefined,
1495+
});
1496+
1497+
expect(container.querySelector(".chat-open-split-view")).toBeNull();
1498+
});
1499+
14771500
it("suppresses the floating workspace toggle when a pane header hosts it", () => {
14781501
const container = renderChatView({
14791502
paneHeaderActive: true,

‎ui/src/pages/chat/chat-view.ts‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ export type ChatProps = {
169169
/** True when a split pane header hosts the workspace toggle; suppresses the
170170
* single-pane floating opener so only one affordance renders. */
171171
paneHeaderActive?: boolean;
172+
/** Split-view opener shown in the floating toggle cluster. Only set for the
173+
* single wide pane — split mode owns its controls in pane headers. */
174+
onOpenSplitView?: () => void;
172175
taskSuggestions?: TaskSuggestion[];
173176
taskSuggestionBusyIds?: ReadonlySet<string>;
174177
canAcceptTaskSuggestions?: boolean;
@@ -419,9 +422,25 @@ export function renderChat(props: ChatProps) {
419422
panel's header controls; hide them while the sidebar is open. -->
420423
${!props.paneHeaderActive &&
421424
!sidebarOpen &&
422-
(props.sessionWorkspace?.collapsed || props.backgroundTasks?.collapsed)
425+
(props.onOpenSplitView ||
426+
props.sessionWorkspace?.collapsed ||
427+
props.backgroundTasks?.collapsed)
423428
? html`
424429
<div class="chat-floating-toggles">
430+
${props.onOpenSplitView
431+
? html`
432+
<openclaw-tooltip .content=${t("chat.splitView.open")}>
433+
<button
434+
class="btn btn--sm btn--icon chat-open-split-view"
435+
type="button"
436+
aria-label=${t("chat.splitView.open")}
437+
@click=${props.onOpenSplitView}
438+
>
439+
${icons.columns2}
440+
</button>
441+
</openclaw-tooltip>
442+
`
443+
: nothing}
425444
${props.sessionWorkspace?.collapsed
426445
? renderSessionDiffToggle(props.sessionWorkspace, "floating")
427446
: nothing}

‎ui/src/styles/chat/sidebar.css‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464

6565
.chat-workspace-open,
6666
.chat-tasks-open,
67-
.chat-diff-open {
67+
.chat-diff-open,
68+
.chat-open-split-view {
6869
/* Match the 28px pane-header/split-view openers; .btn--icon's
6970
min-width/height of 36px would win otherwise. */
7071
width: 28px;

‎ui/src/styles/chat/split-view.css‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ openclaw-chat-pane {
163163
flex: 0 0 auto;
164164
}
165165

166-
.chat-pane__actions .btn--icon,
167-
.chat-open-split-view.btn--icon {
166+
.chat-pane__actions .btn--icon {
168167
width: 28px;
169168
/* .btn--icon's min-width: 36px otherwise wins over width and stretches
170169
these into 36x28 pills. */
@@ -173,21 +172,3 @@ openclaw-chat-pane {
173172
min-height: 28px;
174173
padding: 5px;
175174
}
176-
177-
.chat-open-split-view {
178-
position: absolute;
179-
right: 16px;
180-
bottom: 16px;
181-
z-index: 12;
182-
border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
183-
background: color-mix(in srgb, var(--panel) 92%, transparent);
184-
box-shadow: var(--shadow-sm);
185-
backdrop-filter: blur(10px);
186-
-webkit-backdrop-filter: blur(10px);
187-
}
188-
189-
@media (max-width: 1099px) {
190-
.chat-open-split-view {
191-
display: none;
192-
}
193-
}

0 commit comments

Comments
 (0)