Skip to content

Commit 35ea45b

Browse files
chief-archivistclaude
authored andcommitted
fix(web): the prompt keeps the interface-scaled size on touch screens
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 2615366 commit 35ea45b

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎apps/web/src/appearanceFonts.browser.test.ts‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import { describe, expect, it } from "vite-plus/test";
33
import "~/index.css";
44
import { applyAppearanceFontVariables } from "./appearanceFonts";
55

6-
function composerFontSize(): string {
6+
function renderedFontSize(style: (probe: HTMLElement) => void): string {
77
const probe = document.createElement("div");
8-
// The composer editor's own size class.
9-
probe.className = "text-(length:--font-size-prompt,var(--text-sm))";
8+
style(probe);
109
document.body.append(probe);
1110
try {
1211
return getComputedStyle(probe).fontSize;
@@ -15,6 +14,17 @@ function composerFontSize(): string {
1514
}
1615
}
1716

17+
const composerFontSize = () =>
18+
renderedFontSize((probe) => {
19+
// The composer editor's own size class.
20+
probe.className = "text-(length:--font-size-prompt,var(--text-sm))";
21+
});
22+
23+
const touchComposerFontSize = () =>
24+
renderedFontSize((probe) => {
25+
probe.style.fontSize = "var(--font-size-prompt-touch)";
26+
});
27+
1828
describe("applyAppearanceFontVariables", () => {
1929
it("sizes the composer from the interface size until fonts are set separately", () => {
2030
const root = document.documentElement;
@@ -31,9 +41,12 @@ describe("applyAppearanceFontVariables", () => {
3141
try {
3242
applyAppearanceFontVariables(root, { ...preferences, separate: false });
3343
expect(composerFontSize()).toBe("17.5px");
44+
expect(touchComposerFontSize()).toBe("17.5px");
3445

3546
applyAppearanceFontVariables(root, { ...preferences, separate: true });
3647
expect(composerFontSize()).toBe("14px");
48+
// iOS zooms into inputs under 16px.
49+
expect(touchComposerFontSize()).toBe("16px");
3750
} finally {
3851
if (style === null) root.removeAttribute("style");
3952
else root.setAttribute("style", style);

‎apps/web/src/index.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
131131
--chat-content-max-width: 46rem;
132132
--thread-details-panel-width: 17.5rem;
133133
/* The prompt on phones: iOS zooms into any input under 16px on focus. */
134-
--font-size-prompt-touch: max(var(--font-size-prompt, 1rem), 16px);
134+
--font-size-prompt-touch: max(var(--font-size-prompt, var(--text-sm)), 16px);
135135
/* Horizontal gutter shared by the page header and the chat column, clear of
136136
the device's safe area. */
137137
--workspace-gutter: 0.75rem;

0 commit comments

Comments
 (0)