diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ee2626b032..339253dd28c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,12 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel ## Unreleased +- Keyboard users can now Tab to an overflowing conversation transcript in Studio and scroll it with the keyboard, with a visible focus outline; transcripts that (#6057). + - Contributing: the pull request template asks speedup PRs for a tools/perf_receipt.py receipt. - CI: three host checks that pass on main run in the Linux test shards again, after sitting on an old exclusion list (#6017). Thanks to @joshuaswarren. - - - Repository: the Ergo model's license text is no longer kept with the Vulkan engine's source; it travels with the checkpoint. - Build: `zig build native` for CUDA fails with a clear message when it would embed no kernel images, instead of building a server that refuses every model (#6011). Thanks to @joshuaswarren. @@ -22,8 +22,6 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel - Handoff manifest: a zero dimension empties a layer's row wherever it is listed, so the same dimensions are accepted or refused independently of their order; a row that really wraps is still refused (#5979, refs #5844). - - - CI: performance PRs can carry a receipt (mirrored A/B plus a greedy token hash with a planted control); a check verifies it, and a trusted follow-up compares the hashes with maintainer-held golden values. - Server: a streamed GLM tool call's header is sent only after its whole envelope parses, so a malformed call can no longer reach the client as raw text after a header delta; non-streamed replies are unchanged (refs #6031). @@ -85,8 +83,6 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel - Lanes: a backend may say before a verify that a stream's next rows find no memory (`Backend.grow`); that stream ends with `length` and a message, and the round's other streams run on instead of the whole round failing. Qwen3.8-27B on Metal with `TF_QWEN27_METAL_KV_PAGES=1` says so when a slot's next rows find no KV page (#3378, part of #1293). - - - Metal tensor parallel: opt-in `TF_TP_HOST_SYNC=1` exchanges through the CPU and shared events instead of GPU kernels spinning on peer-written flags, for macOS releases where those writes are not seen (#5943). - `TENSORFOLD_PREFILL_POLICY=fcfs` keeps a backend's own prompt cut unless the backend declares chunk invariance, so the policy no longer changes output on Flash Next or Gemma 4 on CUDA. diff --git a/app/README.md b/app/README.md index 165bbcf7bd4..4a9dcaa410c 100644 --- a/app/README.md +++ b/app/README.md @@ -119,6 +119,19 @@ npm run verify # non-build preflight: tests + typecheck + git diff checks `npm test` includes guards that fail when a `*.test.ts`, `*.test.tsx`, or `*.test.mjs` file is not wired into the main test suite, or when source/docs contain non-placeholder email addresses. +To check transcript keyboard navigation, start the browser demo from `app/` with +`npm run dev:web` (on PowerShell, set `$env:VONTRA_NO_ELECTRON = '1'` and run `npm run dev`). +In another terminal in `app/`, run this standalone check with Playwright and Chromium available locally: + +```bash +node scripts/check-transcript-keyboard.mjs http://127.0.0.1:5173/ +``` + +Use the demo's actual port. If Playwright is installed outside `app/`, pass its absolute module +path as the next argument. You can pass a Chromium executable path as the final argument. +The check verifies Tab and Page Down on an overflowing transcript and skips the transcript +in the tab order when it is empty. + ### Phone control from chat Open **Phone** beside the model picker in a chat, refresh devices and connect your phone. diff --git a/app/scripts/check-transcript-keyboard.mjs b/app/scripts/check-transcript-keyboard.mjs new file mode 100644 index 00000000000..bb6f8be18f6 --- /dev/null +++ b/app/scripts/check-transcript-keyboard.mjs @@ -0,0 +1,68 @@ +import assert from 'node:assert/strict' +import { createRequire } from 'node:module' + +// Run against Studio's browser demo with a locally installed Playwright and Chromium. +const [url = 'http://127.0.0.1:5173/', playwright = 'playwright', executablePath] = process.argv.slice(2) +const origin = new URL(url) +assert.ok(['127.0.0.1', 'localhost'].includes(origin.hostname), 'Use a loopback Studio demo URL') +let chromium +try { + ({ chromium } = createRequire(import.meta.url)(playwright)) +} catch (error) { + throw new Error('Could not load Playwright. Pass the absolute path to its module as the second argument. See app/README.md.', { cause: error }) +} +const browser = await chromium.launch({ executablePath }) + +try { + const page = await browser.newPage({ viewport: { width: 1280, height: 900 } }) + await page.route('**/*', route => new URL(route.request().url()).origin === origin.origin ? route.continue() : route.abort()) + await page.goto(origin.href, { waitUntil: 'domcontentloaded', timeout: 90_000 }) + const fixture = count => page.evaluate(async ({ count, chat }) => { + const { useStore } = await import('/src/lib/store.ts') + const state = useStore.getState() + const timeline = Array.from({ length: count }, (_, index) => ({ + id: `keyboard-fixture-${index}`, kind: 'notice', text: `Synthetic transcript line ${index}`, createdAt: index + 1, + })) + useStore.setState({ threads: [{ ...chat, incognito: true, timeline }, ...state.threads.filter(row => row.id !== chat.id)] }) + }, { count, chat }) + + const scroller = page.locator('div.scroll-thin.overflow-y-auto.select-text') + const exportButton = page.getByRole('button', { name: 'Export readable text', exact: true }) + const composer = page.getByRole('textbox', { name: 'Message composer', exact: true }) + await page.locator('#root > *').first().waitFor({ state: 'attached' }) + const chat = await page.evaluate(async () => { + const { useStore } = await import('/src/lib/store.ts') + await useStore.getState().newChat() + const { threads, view } = useStore.getState() + const thread = threads.find(thread => thread.id === view.id) + if (!thread) throw new Error('Studio demo did not create the chat') + useStore.setState({ threads: threads.filter(row => row.id !== thread.id) }) + return thread + }) + await page.getByRole('heading', { name: 'Conversation unavailable' }).waitFor() + await fixture(35) + await page.getByText('Synthetic transcript line 0', { exact: true }).waitFor() + assert.ok(await scroller.evaluate(node => node.scrollHeight > node.clientHeight), 'The long fixture must overflow') + assert.equal(await scroller.getAttribute('tabindex'), '0', 'The scroller must have an explicit tab stop') + await exportButton.focus() + await page.keyboard.press('Tab') + assert.equal(await scroller.evaluate(node => node === document.activeElement), true, 'Tab reaches the transcript') + assert.equal(await scroller.evaluate(node => getComputedStyle(node).outlineStyle), 'solid', 'Keyboard focus has a visible outline') + await page.keyboard.press('Home') + await page.waitForFunction(() => document.activeElement.scrollTop === 0) + await page.keyboard.press('PageDown') + await page.waitForFunction(() => document.activeElement.scrollTop > 0) + await page.keyboard.press('Tab') + assert.equal(await composer.evaluate(node => node === document.activeElement), true, 'Tab continues to the composer') + + await fixture(0) + await page.getByText('Synthetic transcript line 0', { exact: true }).waitFor({ state: 'hidden' }) + assert.ok(await scroller.evaluate(node => node.scrollHeight <= node.clientHeight), 'The empty fixture must fit') + await scroller.and(page.locator('[tabindex="-1"]')).waitFor() + await exportButton.focus() + await page.keyboard.press('Tab') + assert.equal(await scroller.evaluate(node => !node.contains(document.activeElement)), true, 'Tab skips the empty transcript') + console.log('Desktop transcript keyboard check passed for overflowing and empty conversations') +} finally { + await browser.close() +} diff --git a/app/src/components/Thread.tsx b/app/src/components/Thread.tsx index 0ddcd77b899..5345842de34 100644 --- a/app/src/components/Thread.tsx +++ b/app/src/components/Thread.tsx @@ -10,7 +10,7 @@ import { ReadableExportDialog } from './reading/ReadableExportDialog' import { requestConversationSearch } from './search/search-events' import { useConversationSearchTarget } from './search/useConversationSearchTarget' import { SentUserMessage, EarlierMessageRevisions } from './SentUserMessage' -import { useEffect, useMemo, useRef, useState } from 'react' +import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react' import { threadPendingApproval } from '../lib/thread-approval' import { useStore } from '../lib/store' import { api } from '../lib/ipc' @@ -60,6 +60,8 @@ export function ThreadView({ threadId, simpleLayout = false }: { threadId: strin const [reviewOpen, setReviewOpen] = useState(false) const [exportOpen, setExportOpen] = useState(false) const scrollRef = useRef(null) + const transcriptContentRef = useRef(null) + const [transcriptOverflows, setTranscriptOverflows] = useState(false) const endRef = useRef(null) const followRef = useRef(true) const [revealedTurns, setRevealedTurns] = useState>({}) @@ -98,6 +100,25 @@ export function ThreadView({ threadId, simpleLayout = false }: { threadId: strin const searchTarget = useConversationSearchTarget({ threadId, timeline, rows: turnRows, scrollRef, followRef, revealWork: key => setRevealedTurns(previous => ({ ...previous, [key]: (previous[key] ?? 0) + 1 })) }) const transcriptWindow = useTranscriptWindow(threadId, turnRows, searchTarget.itemId, scrollRef) + const hasThread = Boolean(thread) + useLayoutEffect(() => { + const scroller = scrollRef.current + const content = transcriptContentRef.current + if (!scroller || !content) return + + let measuredOverflow: boolean | undefined + const measure = () => { + const next = scroller.clientHeight > 0 && scroller.scrollHeight > scroller.clientHeight + if (next === measuredOverflow) return + measuredOverflow = next + setTranscriptOverflows(next) + } + const observer = new ResizeObserver(measure) + observer.observe(scroller) + observer.observe(content) + measure() + return () => observer.disconnect() + }, [hasThread, threadId]) const userTurns = useMemo(() => timeline.filter((item) => item.kind === 'user').length, [timeline]) // Turns that have a checkpoint can be undone from their edits card. const [checkpointTurns, setCheckpointTurns] = useState>(() => new Set()) @@ -224,8 +245,15 @@ export function ThreadView({ threadId, simpleLayout = false }: { threadId: strin {reviewOpen && setReviewOpen(false)} />} {exportOpen && item.kind === 'user' || item.kind === 'assistant').map((item, index) => ({ id: item.id, label: `${index + 1}. ${item.kind === 'user' ? 'You' : 'Assistant'}: ${(item.text || '').slice(0, 90)}` }))} api={api} onClose={() => setExportOpen(false)} />} {searchTarget.notice &&
{searchTarget.notice}
} -
-
+
+
{thread.bot && } {simpleLayout && thread.kind === 'chat' && !timeline.length && !busy &&