Public: anyone can read this; the crew can change it.

On a phone, Chats is a labelled 44 px button that opens the list at the top #16631

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

talk-chats-opener → main 0 commits 1 thread · 1 unresolved

  • Merged. talk-chats-opener was merged into main as fe2252f.

Review

Sign in to review this change.
5 files changed +45 −8
docs/features/talk.md +1 −1
@@ -20,7 +20,7 @@ The agent reaches the forge only through its MCP, as you. Its `tools/list` is th
2020
2121 Reached from the Talk icon in every page's top bar, "Talk to the forge" in the palette (`Ctrl/Cmd+K`), `g t`, and the Talk button beside the tell box on home. Signed out, it sends you to /signin and back. It shows your own conversation (the last 50 turns, oldest at the top, opened on the newest; "Earlier" puts the 50 before them above, in order, and keeps the turn being read where it was, or opens them as a page of their own without the script) and a composer; Enter sends and Shift+Enter breaks a line. `/` jumps to the composer from anywhere on the page except inside a field (and with no Ctrl, Cmd or Alt held); the composer carries `aria-keyshortcuts="/"`. It is a web shortcut only: the terminal door (`ssh <forge> talk`, `forge talk`) takes its words as typed and has no shortcut keys, so `/` there is just a character.
2222
23 On a phone the composer is sticky and lifts above the on-screen keyboard (the script sets `--kb` from `visualViewport`); the head is one row (the list, the title, the model picker, Chat and Preview beside a preview, the menu and New) that never wraps, and a wide table scrolls inside its message, never the page. `test/talk-phone.test.ts` measures these at 360 and 390 px in Chromium with touch; in the forge's own check a missing Chromium fails it rather than skipping; the log is a `role=log` (polite, additions only) and the status line `role=status`, each already a polite live region, so a reply is announced once.
23 On a phone the composer is sticky and lifts above the on-screen keyboard (the script sets `--kb` from `visualViewport`); the head is one row (Chats, a 44 px button named by its word that opens the chat list at its top on the newest chat, then the title, the model picker, Chat and Preview beside a preview, the menu and New) that never wraps, and a wide table scrolls inside its message, never the page. `test/talk-phone.test.ts` measures these at 360, 375 and 390 px in Chromium with touch; in the forge's own check a missing Chromium fails it rather than skipping; the log is a `role=log` (polite, additions only) and the status line `role=status`, each already a polite live region, so a reply is announced once.
2424
2525 A reply streams in over `GET /talk/stream?after=<turn id>` (server-sent events, one `turn` frame per stored turn, each carrying the server-rendered markup, and `live` frames for the block being written, see "Live" below). The stream ends with the turn (`done`), or after 40 seconds (`more`), well inside the edge's timeout; the page then reconnects from the last turn id it saw (`Last-Event-ID` works too). Without the script the composer is a plain form and a reload shows the answer.
2626
src/web/pages/talk.ts +1 −1
@@ -502,7 +502,7 @@ function hereBar(ctx: Ctx, conversation: Conversation, context: Context | undefi
502502 const item = (action: string, field: string, value: string, label: string, ic: "pin" | "history" | "trash"): Html =>
503503 html`<form method="post" action="${urlOf(conversation)}/${action}"><input type="hidden" name="${field}" value="${value}" /><button class="menu-item" type="submit">${icon(ic)}<span class="grow">${label}</span></button></form>`;
504504 return html`<header class="talk-head">
505 <a class="btn btn-icon talk-back" data-variant="ghost" href="${urlOf(conversation)}?chats=1" aria-label="Conversations" title="Conversations">${icon("comment")}</a>
505 <a class="btn talk-back" data-variant="ghost" href="${urlOf(conversation)}?chats=1" title="All your chats, newest first">${icon("comment")}Chats</a>
506506 <h2 class="talk-title">${nameOf(conversation)}${archived ? " (archived)" : ""}</h2>
507507 ${picker}
508508 ${tabs}
src/web/pages/talk_client.ts +3 −2
@@ -88,10 +88,11 @@ body:has(.talk-page) .topbar { background: var(--bg); backdrop-filter: none; -we
8888 .talk-rename { display: flex; gap: 8px; padding: 8px; }
8989 .talk-rename .input { min-width: 0; flex: 1; font-size: 16px; }
9090 .talk-tabs { flex: none; }
91 .talk-back { flex: none; min-height: 2.75rem; gap: 4px; padding-inline: 8px; }
9192 .talk-head .talk-tabs { padding-block: 0; }
9293 [data-split] .talk-head > form { display: none; }
9394 .talk-tabs a { min-height: 2.75rem; display: inline-flex; align-items: center; }
94 @media (max-width: 30rem) { .talk-tabs a { padding-inline: 6px; } .talk-head > .talk-fill { display: none; } }
95 @media (max-width: 30rem) { .talk-tabs a { padding-inline: 6px; } .talk-head > .talk-fill, .talk-back .ico { display: none; } }
9596 .talk-body table { display: block; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; background: linear-gradient(to right, var(--bg) 30%, transparent) left / 24px 100% no-repeat local, linear-gradient(to left, var(--bg) 30%, transparent) right / 24px 100% no-repeat local, linear-gradient(to right, var(--border-strong), transparent) left / 8px 100% no-repeat scroll, linear-gradient(to left, var(--border-strong), transparent) right / 8px 100% no-repeat scroll; }
9697 .talk-body :is(td, th) { overflow-wrap: normal; word-break: normal; }
9798 .talk-body td code { white-space: nowrap; }
@@ -237,7 +238,7 @@ body:has(.talk-page) .topbar { background: var(--bg); backdrop-filter: none; -we
237238 .talk-steer { border-radius: 999px; }
238239 .talk-dictate[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
239240 .talk-foot { margin: 6px 16px 0; }
240 .talk-model { flex: 0 1 7rem; min-width: 4rem; margin: 0; display: flex; align-items: center; gap: 4px; }
241 .talk-model { flex: 0 1 7rem; min-width: 3.25rem; margin: 0; display: flex; align-items: center; gap: 4px; }

Shrinking the picker to 3.25rem pays for the Chats label. Check that it is still readable and tappable at 360 px, and that its select is 44 px tall, not 2.5rem.

241242 .talk-model select { width: 100%; min-width: 0; min-height: 2.5rem; font-size: 16px; text-overflow: ellipsis; }
242243 .talk-status { margin: 4px 16px 0; min-height: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
243244 [data-answering] .talk-status { background: none; animation: none; color: transparent; }
test/talk-page.test.ts +2 −1
@@ -120,7 +120,8 @@ describe("the page", () => {
120120 expect(html).not.toMatch(/data-shell[^>]*data-split/);
121121 expect(html).not.toContain('class="talk-work"');
122122 expect(html).not.toContain(`class="seg talk-tabs"`);
123 expect(html).toMatch(/<a class="btn btn-icon talk-back" data-variant="ghost" href="\/talk\/[^"?]+\?chats=1" aria-label="Conversations"/);
123 // Named by its own visible word (#16442): a phone finds "Chats", not an unlabelled icon.
124 expect(html).toMatch(/<a class="btn talk-back" data-variant="ghost" href="\/talk\/[^"?]+\?chats=1"[^>]*>(<svg[\s\S]*?<\/svg>)?Chats<\/a>/);
124125 expect(html.indexOf('class="talk-chats"')).toBeLessThan(html.indexOf('class="talk-head'));
125126 const listed = await (await get("/talk?chats=1", alice)).text();
126127 expect(listed).toContain(`data-pane="chat" data-view="list"`);
test/talk-phone.test.ts +38 −3
@@ -1,5 +1,6 @@
11 /**
2 * Talk on a phone (#16442, #16560), measured in a real Chromium at 360 and 390 px with a finger:
2 * Talk on a phone (#16442, #16560), measured in a real Chromium at 360, 375 and 390 px with a
3 * finger:
34 * the head is one row (the list, the title, the model picker, the tabs, the menu and New) and
45 * nothing in it wraps; the composer does not move as the status line or the tool-call count change;
56 * the chat list opens at its top on the newest chat; the "answering" line ends with the answer; a
@@ -44,7 +45,7 @@ if (skip)
4445 "SKIPPING: no chromium that starts on this machine, so Talk on a phone is not measured",
4546 );
4647
47 const WIDTHS = [360, 390] as const;
48 const WIDTHS = [360, 375, 390] as const;
4849 let dir: string;
4950 let app: App;
5051 let servers: Servers;
@@ -294,7 +295,7 @@ for (const width of WIDTHS) {
294295 for (const k of m.kids) {
295296 expect(k.right, seen).toBeLessThanOrEqual(width);
296297 expect(k.bottom, seen).toBeLessThanOrEqual(top + 48);
297 if (/btn-icon|menu|FORM/.test(k.cls))
298 if (/btn-icon|talk-back|menu|FORM/.test(k.cls))
298299 expect(Math.min(k.w, k.h), seen).toBeGreaterThanOrEqual(44);
299300 }
300301 // The title keeps at least a few letters.
@@ -311,6 +312,40 @@ for (const width of WIDTHS) {
311312 30_000,
312313 );
313314
315 test.skipIf(skip)(
316 `${width} px: Chats is a labelled 44 px control in the head, and it opens the list at its top on the newest chat`,
317 async () => {
318 // Bob's Talk opens on his newest chat; the way to the others is in its head.
319 const at = await phone(
320 width,
321 `/talk`,
322 listToken,
323 `(() => {
324 const head = document.querySelector(".talk-head"), a = [...head.querySelectorAll("a")].find((x) => x.textContent.trim() === "Chats");
325 if (!a) return JSON.stringify({ found: false, head: head.innerText });
326 const r = a.getBoundingClientRect(), h = head.getBoundingClientRect();
327 return JSON.stringify({ found: true, href: a.getAttribute("href"), w: r.width, h: r.height, left: r.left, right: r.right, top: r.top, bottom: r.bottom, headTop: h.top, headBottom: h.bottom, shown: getComputedStyle(a).visibility === "visible" && r.width > 0 });
328 })()`,
329 );
330 const seen = JSON.stringify(at);
331 expect(at.found, seen).toBe(true);
332 expect(at.shown, seen).toBe(true);
333 expect(Math.min(at.w, at.h), seen).toBeGreaterThanOrEqual(44);
334 expect(at.left, seen).toBeGreaterThanOrEqual(0);
335 expect(at.right, seen).toBeLessThanOrEqual(width);
336 expect(at.top, seen).toBeGreaterThanOrEqual(at.headTop);
337 expect(at.bottom, seen).toBeLessThanOrEqual(at.headBottom);
338 expect(at.href, seen).toEndWith("?chats=1");
339 const list = await phone(width, at.href, listToken, `(async () => { await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r))); const first = document.querySelector(".talk-list .row"); const r = first.getBoundingClientRect(); return JSON.stringify({ y: scrollY, top: r.top, bottom: r.bottom, vh: innerHeight, text: first.textContent }); })()`);
340 const said = JSON.stringify(list);
341 expect(list.y, said).toBe(0);
342 expect(list.top, said).toBeGreaterThanOrEqual(0);
343 expect(list.bottom, said).toBeLessThanOrEqual(list.vh);
344 expect(list.text, said).toContain("Chat number 19");
345 },
346 30_000,
347 );
348
314349 test.skipIf(skip)(
315350 `${width} px: the chat list opens at its top, the newest chat in view`,
316351 async () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs