Skip to content

Commit 8fa897a

Browse files
authored
improve(ui): align transient menu chrome with design-system geometry (#122109)
* improve(ui): align transient menu chrome with design-system geometry Use one shared transient-menu recipe across Control UI panels and items. Match the carapace reference: 6px item radius plus 4px inset yields a 10px panel radius, with restrained motion for fixed menus. * test(ui): align gateway picker menu expectations * test(cli): keep benign sqlite diagnostics out of ACP exit stderr assertions * fix(ui): restore 44px menu touch targets on coarse pointers
1 parent cc9119e commit 8fa897a

14 files changed

Lines changed: 196 additions & 121 deletions

‎src/cli/acp-cli-exit.process.test.ts‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "node:child_process";
88
import { createServer } from "node:http";
99
import path from "node:path";
10-
import { promisify } from "node:util";
10+
import { promisify, stripVTControlCharacters } from "node:util";
1111
import { describe, expect, it } from "vitest";
1212
import { type RawData, WebSocketServer } from "ws";
1313
import {
@@ -62,6 +62,17 @@ function createAcpProcessEnv(baseEnv: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
6262
};
6363
}
6464

65+
function withoutSqliteTransactionWarnings(stderr: string): string {
66+
// Slow-hold logger output is load-dependent performance diagnostics, not ACP clean-exit
67+
// signal; see logSlowTransactionHold in sqlite-transaction.ts.
68+
return stderr
69+
.split("\n")
70+
.filter(
71+
(line) => !stripVTControlCharacters(line).trimStart().startsWith("[sqlite/transaction]"),
72+
)
73+
.join("\n");
74+
}
75+
6576
function waitForExit(child: ChildProcessWithoutNullStreams) {
6677
return new Promise<{ code: number | null; signal: NodeJS.Signals | null }>((resolve, reject) => {
6778
child.once("error", reject);
@@ -139,7 +150,7 @@ describe("ACP CLI process exit", () => {
139150
},
140151
);
141152

142-
expect(result.stderr).toBe("");
153+
expect(withoutSqliteTransactionWarnings(result.stderr)).toBe("");
143154
expect(result.stdout).toContain(usage);
144155
} finally {
145156
await state.cleanup();
@@ -173,7 +184,7 @@ describe("ACP CLI process exit", () => {
173184
expect(result.error).toBeUndefined();
174185
expect(result.signal).toBeNull();
175186
expect(result.status).toBe(0);
176-
expect(result.stderr).toBe("");
187+
expect(withoutSqliteTransactionWarnings(result.stderr)).toBe("");
177188
} finally {
178189
await state.cleanup();
179190
}
@@ -272,7 +283,7 @@ describe("ACP CLI process exit", () => {
272283
child.stdin.end();
273284
const exit = await exitPromise;
274285
expect(exit).toEqual({ code: 0, signal: null });
275-
expect(stderr).toBe("");
286+
expect(withoutSqliteTransactionWarnings(stderr)).toBe("");
276287
} finally {
277288
child?.kill("SIGKILL");
278289
for (const socket of wss.clients) {

‎ui/src/components/terminal/terminal-panel-styles.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ export const terminalPanelStyles = css`
4747
width: min(360px, calc(100vw - 24px));
4848
max-height: min(420px, var(--tp-session-menu-max-height));
4949
overflow-y: auto;
50-
border: 1px solid var(--border, #262b34);
51-
border-radius: 8px;
52-
background: var(--bg, #0e1015);
53-
box-shadow: 0 12px 30px rgb(0 0 0 / 35%);
54-
padding: 6px;
50+
padding: var(--menu-padding);
51+
border: 1px solid var(--border-strong);
52+
border-radius: var(--menu-radius);
53+
background: var(--bg-elevated);
54+
box-shadow: var(--shadow-md);
5555
}
5656
.tp-session-menu__header {
5757
display: flex;
@@ -77,15 +77,16 @@ export const terminalPanelStyles = css`
7777
gap: 8px;
7878
width: 100%;
7979
border: 0;
80-
border-radius: 6px;
80+
min-height: var(--menu-item-height);
81+
border-radius: var(--menu-item-radius);
8182
background: transparent;
8283
color: var(--text, #d7dae0);
8384
padding: 7px 8px;
8485
text-align: left;
8586
}
8687
.tp-session:not(:disabled):hover,
8788
.tp-session:not(:disabled):focus-visible {
88-
background: color-mix(in srgb, var(--text, #d7dae0) 10%, transparent);
89+
background: var(--bg-hover);
8990
}
9091
.tp-session:disabled {
9192
opacity: 0.55;

‎ui/src/pages/chat/chat-responsive.browser.test.ts‎

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -872,35 +872,54 @@ describeBrowserLayout.concurrent("chat responsive browser layout", () => {
872872
</body></html>`,
873873
);
874874

875-
const styles = await page.evaluate(() => {
876-
const dropdown = document.querySelector<HTMLElement>(".chat-pane__gateway-menu")!;
877-
const menu = dropdown.shadowRoot!.querySelector<HTMLElement>('[part="menu"]')!;
878-
const item = dropdown.querySelector<HTMLElement>(".chat-pane__gateway-menu-item")!;
879-
const menuStyle = getComputedStyle(menu);
880-
const itemStyle = getComputedStyle(item);
881-
return {
882-
menu: {
883-
borderRadius: menuStyle.borderRadius,
884-
padding: menuStyle.padding,
885-
},
886-
item: {
887-
borderRadius: itemStyle.borderRadius,
888-
fontSize: itemStyle.fontSize,
889-
minHeight: itemStyle.minHeight,
890-
padding: itemStyle.padding,
891-
},
892-
};
893-
});
875+
const readGatewayMenuStyles = () =>
876+
page.evaluate(() => {
877+
const dropdown = document.querySelector<HTMLElement>(".chat-pane__gateway-menu")!;
878+
const menu = dropdown.shadowRoot!.querySelector<HTMLElement>('[part="menu"]')!;
879+
const item = dropdown.querySelector<HTMLElement>(".chat-pane__gateway-menu-item")!;
880+
const menuStyle = getComputedStyle(menu);
881+
const itemStyle = getComputedStyle(item);
882+
return {
883+
menu: {
884+
borderRadius: menuStyle.borderRadius,
885+
padding: menuStyle.padding,
886+
},
887+
item: {
888+
borderRadius: itemStyle.borderRadius,
889+
fontSize: itemStyle.fontSize,
890+
minHeight: itemStyle.minHeight,
891+
padding: itemStyle.padding,
892+
},
893+
};
894+
});
895+
896+
const styles = await readGatewayMenuStyles();
894897

895898
expect(styles).toEqual({
896-
menu: { borderRadius: "8px", padding: "6px" },
899+
menu: { borderRadius: "10px", padding: "4px" },
897900
item: {
898-
borderRadius: "8px",
901+
borderRadius: "6px",
899902
fontSize: "13px",
900-
minHeight: "30px",
903+
minHeight: "28px",
901904
padding: "0px 8px",
902905
},
903906
});
907+
908+
const session = await page.context().newCDPSession(page);
909+
try {
910+
await session.send("Emulation.setTouchEmulationEnabled", {
911+
enabled: true,
912+
maxTouchPoints: 1,
913+
});
914+
await session.send("Emulation.setEmulatedMedia", {
915+
media: "screen",
916+
features: [{ name: "pointer", value: "coarse" }],
917+
});
918+
expect(await page.evaluate(() => matchMedia("(pointer: coarse)").matches)).toBe(true);
919+
expect((await readGatewayMenuStyles()).item.minHeight).toBe("44px");
920+
} finally {
921+
await session.detach();
922+
}
904923
} finally {
905924
await closeBrowserPage(page);
906925
}

‎ui/src/styles/base.css‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@
166166
--radius-full: 9999px;
167167
--radius: 10px;
168168

169+
/* Menu items stay optically parallel to their panel edge: radius 6 + padding 4
170+
= panel radius 10. Shared knobs keep transient menus from drifting again. */
171+
--menu-radius: var(--radius-md);
172+
--menu-item-radius: var(--radius-sm);
173+
--menu-item-height: 28px;
174+
--menu-padding: 4px;
175+
169176
/* Transitions - Crisp and responsive */
170177
--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
171178
--ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
@@ -189,6 +196,13 @@
189196
color-scheme: dark;
190197
}
191198

199+
/* Menu actions follow the platform 44px touch-target contract for coarse pointers. */
200+
@media (pointer: coarse) {
201+
:root {
202+
--menu-item-height: 44px;
203+
}
204+
}
205+
192206
/* The claw family deepens only the text-bearing destructive fill. */
193207
:root[data-theme="dark"] {
194208
--destructive: #d32f2f;
@@ -852,6 +866,17 @@ textarea,
852866
}
853867
}
854868

869+
@keyframes menu-in {
870+
from {
871+
opacity: 0;
872+
transform: translateY(6px) scale(0.985);
873+
}
874+
to {
875+
opacity: 1;
876+
transform: translateY(0) scale(1);
877+
}
878+
}
879+
855880
@keyframes scale-in {
856881
from {
857882
opacity: 0;

‎ui/src/styles/board.css‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ openclaw-board-view {
114114

115115
.board-tabs__overflow::part(menu),
116116
.board-widget__menu::part(menu) {
117-
background: var(--panel);
118-
border: 1px solid var(--board-line);
119-
border-radius: 10px;
120-
box-shadow: 0 18px 48px rgb(0 0 0 / 32%);
121117
min-width: 190px;
122-
padding: 6px;
118+
padding: var(--menu-padding);
119+
border: 1px solid var(--border-strong);
120+
border-radius: var(--menu-radius);
121+
background: var(--bg-elevated);
122+
box-shadow: var(--shadow-md);
123123
}
124124

125125
.board-tabs__overflow-item {

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

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,12 +1548,13 @@ openclaw-chat-video-player {
15481548
.chat-reply-context-menu {
15491549
position: fixed;
15501550
z-index: 9999;
1551-
background: var(--bg);
1552-
border: 1px solid var(--border);
1553-
border-radius: 8px;
1554-
padding: 4px;
1555-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
1551+
padding: var(--menu-padding);
1552+
border: 1px solid var(--border-strong);
1553+
border-radius: var(--menu-radius);
1554+
background: var(--bg-elevated);
1555+
box-shadow: var(--shadow-md);
15561556
min-width: 160px;
1557+
animation: menu-in 140ms var(--ease-out);
15571558
}
15581559

15591560
.chat-reply-context-menu button {
@@ -1565,13 +1566,14 @@ openclaw-chat-video-player {
15651566
border: none;
15661567
background: none;
15671568
color: var(--text);
1568-
border-radius: 6px;
1569+
min-height: var(--menu-item-height);
1570+
border-radius: var(--menu-item-radius);
15691571
text-align: left;
15701572
}
15711573

15721574
.chat-reply-context-menu button:hover,
15731575
.chat-reply-context-menu button:focus-visible {
1574-
background: color-mix(in srgb, var(--accent) 12%, transparent);
1576+
background: var(--bg-hover);
15751577
outline: none;
15761578
}
15771579

@@ -1580,11 +1582,11 @@ openclaw-chat-video-player {
15801582
z-index: 9999;
15811583
display: flex;
15821584
gap: 2px;
1583-
background: var(--bg);
1584-
border: 1px solid var(--border);
1585-
border-radius: 8px;
1586-
padding: 3px;
1587-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
1585+
padding: var(--menu-padding);
1586+
border: 1px solid var(--border-strong);
1587+
border-radius: var(--menu-radius);
1588+
background: var(--bg-elevated);
1589+
box-shadow: var(--shadow-md);
15881590
animation: fade-in 0.12s var(--ease-out);
15891591
}
15901592

@@ -1596,14 +1598,15 @@ openclaw-chat-video-player {
15961598
border: none;
15971599
background: none;
15981600
color: var(--text);
1599-
border-radius: 6px;
1601+
min-height: var(--menu-item-height);
1602+
border-radius: var(--menu-item-radius);
16001603
font-size: 12px;
16011604
white-space: nowrap;
16021605
}
16031606

16041607
.chat-selection-popup button:hover,
16051608
.chat-selection-popup button:focus-visible {
1606-
background: color-mix(in srgb, var(--accent) 12%, transparent);
1609+
background: var(--bg-hover);
16071610
outline: none;
16081611
}
16091612

@@ -2704,11 +2707,11 @@ openclaw-chat-video-player {
27042707

27052708
.agent-chat__attach-menu::part(menu) {
27062709
width: 152px;
2707-
padding: 5px;
2708-
border: 1px solid var(--border);
2709-
border-radius: var(--radius-md);
2710+
padding: var(--menu-padding);
2711+
border: 1px solid var(--border-strong);
2712+
border-radius: var(--menu-radius);
27102713
background: var(--bg-elevated);
2711-
box-shadow: var(--shadow-lg);
2714+
box-shadow: var(--shadow-md);
27122715
}
27132716

27142717
.agent-chat__attach-menu-option {
@@ -3789,13 +3792,13 @@ openclaw-chat-video-player {
37893792
right: 0;
37903793
max-height: 320px;
37913794
overflow-y: auto;
3792-
background: var(--popover);
3795+
background: var(--bg-elevated);
37933796
border: 1px solid var(--border-strong);
3794-
border-radius: var(--radius-lg);
3795-
box-shadow: var(--shadow-lg);
3797+
border-radius: var(--menu-radius);
3798+
box-shadow: var(--shadow-md);
37963799
z-index: 30;
37973800
margin-bottom: 4px;
3798-
padding: 6px;
3801+
padding: var(--menu-padding);
37993802
scrollbar-width: thin;
38003803
}
38013804

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,17 +301,17 @@ openclaw-chat-pane {
301301
}
302302

303303
.chat-pane__gateway-menu::part(menu) {
304-
padding: 6px;
305-
border: 1px solid color-mix(in srgb, var(--border-strong) 78%, transparent);
306-
border-radius: 8px;
304+
padding: var(--menu-padding);
305+
border: 1px solid var(--border-strong);
306+
border-radius: var(--menu-radius);
307307
background: var(--bg-elevated);
308-
box-shadow: var(--shadow-lg);
308+
box-shadow: var(--shadow-md);
309309
}
310310

311311
.chat-pane__gateway-menu-item {
312-
min-height: 30px;
312+
min-height: var(--menu-item-height);
313313
padding: 0 8px;
314-
border-radius: 8px;
314+
border-radius: var(--menu-item-radius);
315315
color: var(--text);
316316
font: inherit;
317317
font-size: 13px;

‎ui/src/styles/chat/tool-cards.css‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,11 @@
783783

784784
.chat-tool-card__widget-actions::part(menu) {
785785
min-width: 176px;
786+
padding: var(--menu-padding);
787+
border: 1px solid var(--border-strong);
788+
border-radius: var(--menu-radius);
789+
background: var(--bg-elevated);
790+
box-shadow: var(--shadow-md);
786791
}
787792

788793
.chat-tool-card__widget-actions-trigger,

‎ui/src/styles/components.css‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3522,11 +3522,11 @@ td.data-table-key-col {
35223522
width: min(320px, calc(100vw - 24px));
35233523
max-height: 320px;
35243524
overflow-y: auto;
3525-
padding: 6px;
3526-
border: 1px solid color-mix(in srgb, var(--border-strong) 78%, transparent);
3527-
border-radius: var(--radius-lg);
3525+
padding: var(--menu-padding);
3526+
border: 1px solid var(--border-strong);
3527+
border-radius: var(--menu-radius);
35283528
background: var(--bg-elevated);
3529-
box-shadow: var(--shadow-lg);
3529+
box-shadow: var(--shadow-md);
35303530
color: var(--text);
35313531
}
35323532

0 commit comments

Comments
 (0)