Skip to content

Commit 6279139

Browse files
fix(ui): pair scale and corner-shape on every corner-curvature selector
ClawSweeper caught two more instances of scale and shape traveling apart: 1. .option-card__choice wasn't in the corner-curvature list at all, despite being a real nested member of the .option-card family (a button inside .option-card__choices inside .option-card, drawn with the same 14px --radius-lg step as .card/.settings-group). It kept its canonical 14px round corner even under the scale. 2. .slash-menu-item / .chat-reply-context-menu button / .chat-selection-popup button picked up the scaled radius from round 2 but never got corner-shape, so their corners grew without curving into a squircle — scale without shape, the same incoherence class as (1) in reverse. Decision on (2): items get corner-shape added (not scale removed). The panel they sit in is already squircle; an item whose radius grows but stays circular reads as an unrelated circle poking out of the panel's superellipse, not a coherent nested row. A final invariant pass over the full @supports block (every selector that sets a live border-radius must also set corner-shape, and vice versa) found one more forgotten member beyond the two reported: .agent-chat__search-bar scaled its own (bottom-only) radius but never carried corner-shape, same gap as the menu items. Fixed alongside the reported two. Every remaining selector in the block already pairs the two; the wa-dropdown/wa-popover/ wa-select host rule is the one correct exception, since it only carries custom properties for descendants and draws no border of its own. Test coverage now exercises each surface's real nested DOM instead of a synthetic flat selector: option-card.ts's actual button-inside-choices- inside-card structure, chat-composer-slash-menu.ts's item three levels below the panel, and chat-thread-interactions.ts's plain <button> item matched via descendant tag selector. Added a corner field to CornerCase so the harness can probe the correct physical corner (search-bar's bottom-left is its only non-zero corner) instead of universally reading top-left. All four new/changed cases are proven to fail on pre-fix base.css with the exact "radius scaled, shape stuck at round" (or, for option-card__choice, "not opted in at all") signature before the corresponding fix.
1 parent f269a89 commit 6279139

2 files changed

Lines changed: 95 additions & 13 deletions

File tree

‎ui/src/styles/base.css‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@
321321
.cmd-palette.cmd-palette,
322322
.login-gate__card.login-gate__card,
323323
.card.card,
324-
.settings-group.settings-group {
324+
.settings-group.settings-group,
325+
.option-card__choice.option-card__choice {
325326
border-radius: calc(14px * var(--openclaw-corner-radius-scale));
326327
corner-shape: superellipse(1.5);
327328
}
@@ -347,13 +348,17 @@
347348
}
348349

349350
/* The transcript search bar's bottom corners round with its .card ancestor
350-
so the two edges stay optically parallel; it carries no corner-shape of
351-
its own (only two corners are rounded, and .chat:has(> .agent-chat__search-bar)
352-
zeroes .card's own radius while the search bar is present — see
353-
chat/layout.css). */
351+
so the two edges stay optically parallel; only two corners are rounded,
352+
and .chat:has(> .agent-chat__search-bar) zeroes .card's own radius while
353+
the search bar is present (see chat/layout.css). corner-shape still
354+
needs to be set here even though the top two corners are 0 (a 0-radius
355+
corner draws no curve either way): the bottom two are standing in for
356+
.card's own squircle corner at the seam, so they need the same shape,
357+
not just the same radius, to actually match it. */
354358
.agent-chat__search-bar.agent-chat__search-bar {
355359
border-radius: 0 0 calc(14px * var(--openclaw-corner-radius-scale))
356360
calc(14px * var(--openclaw-corner-radius-scale));
361+
corner-shape: superellipse(1.5);
357362
}
358363

359364
/* These two add a fixed cosmetic offset on top of the --radius-xl step in
@@ -379,10 +384,15 @@
379384
corner-shape: superellipse(1.5);
380385
}
381386

387+
/* Items pick up corner-shape too, not just the scaled radius: corner-shape
388+
doesn't inherit, and a bigger round radius sitting inside a squircle
389+
panel with no shape of its own reads as an unrelated smaller circle
390+
poking out of a superellipse, not a coherent nested row. */
382391
.slash-menu-item.slash-menu-item,
383392
.chat-reply-context-menu.chat-reply-context-menu button,
384393
.chat-selection-popup.chat-selection-popup button {
385394
border-radius: calc(10px * var(--openclaw-corner-radius-scale) - 4px);
395+
corner-shape: superellipse(1.5);
386396
}
387397

388398
/* wa-dropdown/wa-popover/wa-select: the panel gets the same direct

‎ui/src/styles/corner-shape.browser.test.ts‎

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ const UNSUPPORTED_CONDITION = "@supports (corner-shape: openclaw-unsupported-sha
2424
type CornerCase = {
2525
/** Corner radius an engine without `corner-shape` keeps drawing. */
2626
readonly circular: string;
27+
/** Which physical corner to probe; most fixtures round all four equally,
28+
* so "topLeft" (the default) stands in for the rest. Only a directional
29+
* shorthand like .agent-chat__search-bar's `0 0 var(...) var(...)` needs
30+
* "bottomLeft" — its top corners are permanently 0 either way. */
31+
readonly corner?: "bottomLeft" | "topLeft";
2732
readonly markup: string;
2833
readonly selector: string;
2934
/** Radius once the 1.25 corner scale applies. */
@@ -47,11 +52,23 @@ const CORNER_CASES: readonly CornerCase[] = [
4752
superelliptical: "17.5px",
4853
},
4954
{
55+
// Real DOM shape from option-card.ts: .option-card__choice is a button
56+
// nested two levels inside .option-card, not a synthetic flat div. The
57+
// .option-card__choice case below reuses this same markup — an empty
58+
// markup string there, not a duplicate copy of it.
5059
circular: "20px",
51-
markup: '<div class="option-card">Option</div>',
60+
markup:
61+
'<section class="option-card" role="group"><div class="option-card__choices">' +
62+
'<button type="button" class="option-card__choice">Choice</button></div></section>',
5263
selector: ".option-card",
5364
superelliptical: "25px",
5465
},
66+
{
67+
circular: "14px",
68+
markup: "",
69+
selector: ".option-card__choice",
70+
superelliptical: "17.5px",
71+
},
5572
{
5673
circular: "14px",
5774
markup: '<div class="exec-approval-card">Approval</div>',
@@ -82,6 +99,59 @@ const CORNER_CASES: readonly CornerCase[] = [
8299
selector: ".settings-group",
83100
superelliptical: "17.5px",
84101
},
102+
{
103+
// Real DOM shape from chat-composer-slash-menu.ts: .slash-menu-item is a
104+
// div two levels below .slash-menu (through .slash-menu__scroll and
105+
// .slash-menu-group), not a direct child. Item radius is panel radius
106+
// minus 4px (calc(10px * scale - 4px) in base.css), so it reads a
107+
// different number from the panel at both scales — a real assertion,
108+
// not a copy of the panel's own expected value.
109+
circular: "10px",
110+
markup:
111+
'<div class="slash-menu" role="listbox"><div class="slash-menu__scroll">' +
112+
'<div class="slash-menu-group"><div class="slash-menu-item" role="option">Item</div>' +
113+
"</div></div></div>",
114+
selector: ".slash-menu",
115+
superelliptical: "12.5px",
116+
},
117+
{
118+
circular: "6px",
119+
markup: "",
120+
selector: ".slash-menu-item",
121+
superelliptical: "8.5px",
122+
},
123+
{
124+
// Real DOM shape from chat-thread-interactions.ts: the item is a plain
125+
// <button>, matched by the base.css descendant tag selector
126+
// `.chat-reply-context-menu button`, not a class carried on the item
127+
// itself the way .slash-menu-item is.
128+
circular: "10px",
129+
markup:
130+
'<div class="chat-reply-context-menu" role="menu">' +
131+
'<button type="button" role="menuitem">Reply</button></div>',
132+
selector: ".chat-reply-context-menu",
133+
superelliptical: "12.5px",
134+
},
135+
{
136+
circular: "6px",
137+
markup: "",
138+
selector: ".chat-reply-context-menu button",
139+
superelliptical: "8.5px",
140+
},
141+
{
142+
// Real DOM shape from chat-thread-interactions.ts. Found and fixed
143+
// alongside the two P2s above during a final invariant sweep of every
144+
// selector in the base.css corner block: this one already scaled its
145+
// (bottom-only) radius but never carried corner-shape, same "radius
146+
// grew, shape didn't follow" gap as the menu items. Its only non-zero
147+
// corners are the bottom two (`border-radius: 0 0 var(...) var(...)`),
148+
// so this is the one case that needs the bottom-left probe.
149+
circular: "14px",
150+
corner: "bottomLeft",
151+
markup: '<div class="agent-chat__search-bar"><input type="text" /></div>',
152+
selector: ".agent-chat__search-bar",
153+
superelliptical: "17.5px",
154+
},
85155
];
86156

87157
const ROUND_CASES: readonly CornerCase[] = [
@@ -173,22 +243,24 @@ async function probeCorners(browser: Browser, fixtureFile: string): Promise<Corn
173243
try {
174244
await page.goto(`file://${fixtureFile}`);
175245
return await page.evaluate(
176-
(selectors: readonly string[]) => {
246+
(probes: readonly { selector: string; corner: "bottomLeft" | "topLeft" }[]) => {
177247
return Object.fromEntries(
178-
selectors.map((selector) => {
248+
probes.map(({ selector, corner }) => {
179249
const element = document.querySelector(selector);
180250
if (!element) {
181251
throw new Error(`Missing corner fixture element for ${selector}`);
182252
}
183253
const style = getComputedStyle(element);
184-
return [
185-
selector,
186-
{ radius: style.borderTopLeftRadius, shape: style.getPropertyValue("corner-shape") },
187-
];
254+
const radius =
255+
corner === "bottomLeft" ? style.borderBottomLeftRadius : style.borderTopLeftRadius;
256+
return [selector, { radius, shape: style.getPropertyValue("corner-shape") }];
188257
}),
189258
);
190259
},
191-
ALL_CASES.map((corner) => corner.selector),
260+
ALL_CASES.map((corner) => ({
261+
selector: corner.selector,
262+
corner: corner.corner ?? "topLeft",
263+
})),
192264
);
193265
} finally {
194266
await page.close().catch(() => {});

0 commit comments

Comments
 (0)