Skip to content

Commit 3e59f7e

Browse files
committed
fix(ui): keep sidebar icon endcap intact in single-line session rows
With message preview off, rows collapse to one line and the second-row icon logic (spinner, unread dot, badges, facepile, trail) rides beside the title. Two defects broke that: - Long titles crushed the icon endcap: the single-line title used flex-basis auto, so overflow shrink was distributed onto the endcap (24px -> ~7px), clipping the status icons. Basis 0 now mirrors the two-line subtitle contract: text absorbs all shrink before icons do. - Native catalog session rows always rendered the two-line skeleton with an empty details line (46px vs 30px) and never collapsed, in both preview modes. Catalog rows never carry preview text, so they are now always single-line. Regression coverage: long-title endcap geometry in chat-flow.sidebar-presentation.e2e.test.ts (fails pre-fix), and codex-sessions.e2e.test.ts density assertions updated to the new all-single-line contract.
1 parent 267ffc4 commit 3e59f7e

4 files changed

Lines changed: 56 additions & 14 deletions

File tree

‎ui/src/components/app-sidebar-session-catalog-render.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ function renderCatalogSessionRow(
454454
);
455455
return html`
456456
<div
457-
class="sidebar-recent-session session-row-host ${active
457+
class="sidebar-recent-session session-row-host sidebar-recent-session--single-line ${active
458458
? "sidebar-recent-session--active"
459459
: ""} ${projectChild ? "sidebar-recent-session--catalog-project-child" : ""} ${running
460460
? "session-row-host--running"

‎ui/src/e2e/chat-flow.sidebar-presentation.e2e.test.ts‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ suite.define(() => {
334334
const page = await context.newPage();
335335
const busyKey = "agent:main:busy-session";
336336
const plainKey = "agent:main:plain-session";
337+
const longKey = "agent:main:long-title-session";
337338
await installMockGateway(page, {
338339
methodResponses: {
339340
"sessions.list": chatSessionListResponse([
@@ -364,6 +365,17 @@ suite.define(() => {
364365
label: "A session without secondary metadata",
365366
updatedAt: 1,
366367
},
368+
{
369+
key: longKey,
370+
kind: "direct",
371+
label:
372+
"An extremely long single-line session title that keeps going and going far past the sidebar width",
373+
updatedAt: 1,
374+
activeRunIds: ["run-long-title"],
375+
hasActiveRun: true,
376+
status: "running",
377+
unread: true,
378+
},
367379
]),
368380
},
369381
sessionKey: busyKey,
@@ -447,6 +459,37 @@ suite.define(() => {
447459
expect(atom.bottom).toBeLessThanOrEqual(layout.endcap.bottom);
448460
}
449461

462+
// A long title must truncate instead of crushing the collapsed row's icon
463+
// endcap: the spinner/unread icons keep their intrinsic width and stay
464+
// inside the row, exactly like the two-line endcap under a long subtitle.
465+
const longRow = page.locator(`.sidebar-recent-session[data-session-key="${longKey}"]`);
466+
const longLayout = await longRow.evaluate((row) => {
467+
const endcap = row.querySelector(".sidebar-recent-session__details-endcap");
468+
const name = row.querySelector(".sidebar-recent-session__name");
469+
if (!endcap || !name) {
470+
throw new Error("Missing long-title session row fixture");
471+
}
472+
const endcapBox = endcap.getBoundingClientRect();
473+
const rowBox = row.getBoundingClientRect();
474+
return {
475+
atoms: Array.from(
476+
endcap.querySelectorAll(":scope :is(svg, .session-run-spinner, .session-unread-dot)"),
477+
(element) => element.getBoundingClientRect().width,
478+
),
479+
endcapWidth: endcapBox.width,
480+
endcapRight: endcapBox.right,
481+
nameOverflowing: name.scrollWidth > name.clientWidth,
482+
rowRight: rowBox.right,
483+
singleLine: row.classList.contains("sidebar-recent-session--single-line"),
484+
};
485+
});
486+
expect(longLayout.singleLine).toBe(true);
487+
expect(longLayout.nameOverflowing).toBe(true);
488+
expect(longLayout.endcapRight).toBeLessThanOrEqual(longLayout.rowRight);
489+
const intrinsicAtomWidth = longLayout.atoms.reduce((sum, width) => sum + width, 0);
490+
expect(intrinsicAtomWidth).toBeGreaterThan(0);
491+
expect(longLayout.endcapWidth).toBeGreaterThanOrEqual(intrinsicAtomWidth);
492+
450493
await busyRow.hover();
451494
await expect
452495
.poll(() =>

‎ui/src/e2e/codex-sessions.e2e.test.ts‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -498,22 +498,18 @@ suite.define(() => {
498498
}),
499499
);
500500
expect(threadRowMetrics).toHaveLength(4);
501-
// Gateway threads and native catalog children must stay density-identical, but a
502-
// row with no preview text collapses to one line. Assert uniformity per shape, so
503-
// the two sources drifting apart still fails while the collapse stays legal.
504-
const singleLineHeights = new Set(
505-
threadRowMetrics.filter((metric) => metric.singleLine).map((metric) => metric.height),
506-
);
507-
const twoLineHeights = new Set(
508-
threadRowMetrics.filter((metric) => !metric.singleLine).map((metric) => metric.height),
509-
);
501+
// Gateway threads and native catalog children must stay density-identical.
502+
// Catalog children never carry preview text, so every subtitle-less row —
503+
// whichever source it came from — collapses to the same one-line height
504+
// instead of reserving a phantom second line.
505+
for (const metric of threadRowMetrics) {
506+
expect(metric.singleLine).toBe(true);
507+
}
508+
const singleLineHeights = new Set(threadRowMetrics.map((metric) => metric.height));
510509
expect(singleLineHeights.size).toBe(1);
511-
expect(twoLineHeights.size).toBe(1);
512510
const [collapsedHeight] = [...singleLineHeights];
513-
const [expandedHeight] = [...twoLineHeights];
514511
// Collapsed rows sit on the 30px min-height floor; renderer sub-pixels vary.
515512
expect(collapsedHeight).toBeCloseTo(30, 1);
516-
expect(expandedHeight).toBeGreaterThan(collapsedHeight!);
517513
for (const metric of threadRowMetrics) {
518514
expect(metric).toMatchObject({
519515
minHeight: "30px",

‎ui/src/styles/layout.css‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4254,9 +4254,12 @@ html:not(.openclaw-native-macos):not(.openclaw-native-nav):not(.openclaw-native-
42544254
gap: var(--sidebar-row-gap);
42554255
}
42564256

4257+
/* Basis 0 mirrors the two-line subtitle contract: the title absorbs all
4258+
shrink, so the icon endcap keeps its intrinsic width until it alone
4259+
exceeds the row. Basis auto let long titles crush the endcap to ~0. */
42574260
.sidebar-recent-session--single-line .sidebar-recent-session__name {
42584261
width: auto;
4259-
flex: 1 1 auto;
4262+
flex: 1 1 0;
42604263
}
42614264

42624265
.sidebar-recent-session--single-line > .sidebar-recent-session__aside {

0 commit comments

Comments
 (0)