Skip to content

Commit 1ea18c8

Browse files
fix(ui): keep mobile side chat interactive in tabbed panel (#124785)
Keep embedded mobile Side chat inside its tabbed panel so the main composer and shared controls stay tappable. Co-authored-by: Tak Hoffman <[email protected]>
1 parent 03f43ee commit 1ea18c8

2 files changed

Lines changed: 52 additions & 3 deletions

File tree

‎ui/src/e2e/chat-rail-columns.e2e.test.ts‎

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ function scenario(): ControlUiMockGatewayScenario {
7878
additions: 4,
7979
deletions: 2,
8080
},
81+
"sessions.companion.ask": {
82+
answer: "The mobile side chat stayed inside its panel.",
83+
ts: Date.UTC(2026, 7, 16, 12, 0),
84+
},
85+
"sessions.companion.state": { exchanges: [] },
8186
"sessions.files.list": {
8287
browser: {
8388
path: "ui/src/pages/chat",
@@ -872,13 +877,15 @@ suite.define(() => {
872877
},
873878
async ({ page }) => {
874879
await seedSettings(page, "light");
875-
await installMockGateway(page, scenario());
880+
const gateway = await installMockGateway(page, scenario());
876881
await page.goto(`${suite.server.baseUrl}chat`);
877882
await page.locator(".chat-group").first().waitFor();
878883
await page.locator(".chat-side-panel-toggle").click();
879884
await openFromEmpty(page, "Files");
880885
await openFromPlus(page, "Terminal");
881-
await expect.poll(async () => tabLabels(page)).toEqual(["Files", "Terminal"]);
886+
await openFromPlus(page, "Side chat");
887+
await selectTab(page, "Side chat");
888+
await expect.poll(async () => tabLabels(page)).toEqual(["Files", "Terminal", "Side chat"]);
882889
await expect.poll(() => narrowestRailTabLabel(page)).toBeGreaterThanOrEqual(24);
883890

884891
const geometry = await sidePanel(page).evaluate((element) => {
@@ -889,6 +896,48 @@ suite.define(() => {
889896
expect(geometry.right).toBeLessThanOrEqual(geometry.viewport + 1);
890897
expect(geometry.width).toBeGreaterThan(300);
891898

899+
const companion = sidePanel(page).locator("openclaw-chat-session-rail");
900+
const companionGeometry = await companion.locator(".chat-session-rail").evaluate((rail) => {
901+
const body = rail.closest(".side-panel__body");
902+
const bodyRect = body?.getBoundingClientRect();
903+
const railRect = rail.getBoundingClientRect();
904+
return {
905+
bodyBottom: bodyRect?.bottom ?? 0,
906+
bodyTop: bodyRect?.top ?? 0,
907+
railBottom: railRect.bottom,
908+
railTop: railRect.top,
909+
};
910+
});
911+
expect(companionGeometry.railTop).toBeGreaterThanOrEqual(companionGeometry.bodyTop - 1);
912+
expect(companionGeometry.railBottom).toBeLessThanOrEqual(companionGeometry.bodyBottom + 1);
913+
914+
const mainComposer = page.locator(".agent-chat__composer-combobox > textarea");
915+
await mainComposer.click();
916+
expect(await mainComposer.evaluate((element) => element === document.activeElement)).toBe(
917+
true,
918+
);
919+
const input = companion.getByRole("textbox", { name: "Ask the session companion" });
920+
await input.fill("Can I use side chat here?");
921+
await companion.getByRole("button", { name: "Ask", exact: true }).click();
922+
const request = await gateway.waitForRequest("sessions.companion.ask");
923+
expect(request.params).toEqual({
924+
agentId: "main",
925+
question: "Can I use side chat here?",
926+
sessionKey,
927+
});
928+
await companion
929+
.getByText("The mobile side chat stayed inside its panel.", { exact: true })
930+
.waitFor();
931+
const companionActions = sidePanel(page).getByRole("button", {
932+
name: "More companion actions",
933+
});
934+
await companionActions.click();
935+
await sidePanel(page)
936+
.locator('wa-dropdown-item[value="clear"]')
937+
.waitFor({ state: "visible" });
938+
await page.keyboard.press("Escape");
939+
await captureRichPanel(page, "rails-side-chat-mobile-light");
940+
892941
await sidePanel(page).getByRole("button", { name: "Expand side panel" }).click();
893942
await expect
894943
.poll(() =>

‎ui/src/styles/components.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2291,7 +2291,7 @@ openclaw-chat-session-rail {
22912291

22922292
/* No pane can hold a column at this width, so the companion takes the whole
22932293
surface rather than hovering over part of it. */
2294-
.chat-session-rail--expanded {
2294+
.chat-session-rail--expanded:not(.chat-session-rail--embedded) {
22952295
position: fixed;
22962296
z-index: 35;
22972297
inset: 0;

0 commit comments

Comments
 (0)