Skip to content

Commit ff73a14

Browse files
fix(ui): match chat transcript text rendering to prototype (#122328)
* fix(ui): match chat transcript letter spacing * test(ui): match computed zero letter spacing * fix(ui): scope transcript letter spacing * test(ui): compare inherited transcript tracking * fix(ui): scope transcript letter spacing
1 parent 8cd74ab commit ff73a14

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,5 +3298,54 @@ describeBrowserLayout.concurrent("chat responsive browser layout", () => {
32983298
await closeBrowserPage(page);
32993299
}
33003300
});
3301+
3302+
it("matches the reading prototype's transcript letter spacing without changing shared text", async () => {
3303+
const page = await openBrowserPage(1366, 900);
3304+
try {
3305+
await page.setContent(`<!doctype html><html data-theme-mode="dark"><head><style>${readUiCss()}</style></head><body>
3306+
<div class="chat-thread chat-thread--direct" role="log">
3307+
<div class="chat-thread-inner">
3308+
<div class="chat-group assistant">
3309+
<div class="chat-group-messages">
3310+
<div class="chat-bubble">
3311+
<div class="chat-text">
3312+
<p>Aa Bb Cc — Smooth reading depends on the shape, spacing, and contrast of every glyph in a transcript.</p>
3313+
<p>Keep this fixture about text rendering; width and block rhythm are intentionally not asserted here.</p>
3314+
</div>
3315+
</div>
3316+
</div>
3317+
</div>
3318+
</div>
3319+
</div>
3320+
<section class="custodian-surface">
3321+
<div class="chat-bubble"><div class="chat-text">Custodian output</div></div>
3322+
</section>
3323+
<div class="chat-notice"><div class="chat-text chat-notice__body">Compact notice</div></div>
3324+
<div class="cron-run-entry__body chat-text">Cron output</div>
3325+
</body></html>`);
3326+
3327+
const transcriptLetterSpacing = await page
3328+
.locator(".chat-thread .chat-bubble .chat-text")
3329+
.evaluate((element) => getComputedStyle(element).letterSpacing);
3330+
const custodianLetterSpacing = await page
3331+
.locator(".custodian-surface .chat-bubble .chat-text")
3332+
.evaluate((element) => getComputedStyle(element).letterSpacing);
3333+
const noticeLetterSpacing = await page
3334+
.locator(".chat-notice .chat-text")
3335+
.evaluate((element) => getComputedStyle(element).letterSpacing);
3336+
const cronLetterSpacing = await page
3337+
.locator(".cron-run-entry__body.chat-text")
3338+
.evaluate((element) => getComputedStyle(element).letterSpacing);
3339+
const bodyLetterSpacing = await page
3340+
.locator("body")
3341+
.evaluate((element) => getComputedStyle(element).letterSpacing);
3342+
expect(transcriptLetterSpacing).toBe("normal");
3343+
expect(custodianLetterSpacing).toBe(bodyLetterSpacing);
3344+
expect(noticeLetterSpacing).toBe(bodyLetterSpacing);
3345+
expect(cronLetterSpacing).toBe(bodyLetterSpacing);
3346+
} finally {
3347+
await closeBrowserPage(page);
3348+
}
3349+
});
33013350
});
33023351
/* oxlint-disable max-lines -- TODO: split this grandfathered oversized file. */

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,10 @@ img.chat-avatar.chat-avatar--logo {
564564
overflow-wrap: break-word;
565565
}
566566

567+
.chat-thread .chat-bubble {
568+
letter-spacing: 0; /* Custodian shares .chat-bubble but keeps the application-wide tracking. */
569+
}
570+
567571
.chat-group.workspace-conflict .chat-group-messages {
568572
max-width: min(760px, calc(100% - 46px));
569573
}

0 commit comments

Comments
 (0)