fix(web): keyboard focus stays in an OpenDocument preview at its first or last sheet #48130
main fromrefs/pull/48130/head·opened View on GitHubIn an OpenDocument preview (spreadsheet, text or presentation), using the keyboard to press Next or Previous until the last or first sheet disabled the button that had focus, so focus fell out of the preview. The viewer now moves focus to its own container just before that step, as the PDF viewer already does. The container shows a focus ring when focused from the keyboard, so users can still see where focus is.
Related: #47774, #47762, #34394
Reproduction on main#
Commit cc19795ea7 (main). The second sheet opens, but focus leaves the spreadsheet preview. Expected: The second sheet opens and keyboard focus stays in the spreadsheet preview.
- Open a two-sheet OpenDocument spreadsheet from the Files panel.
- Tab to Next sheet on the first sheet.
- Press Enter.
The cause is at apps/web/src/components/files/OfficeViewer.tsx:333. Ran pnpm scenarios:prove scripts/scenarios/ods-sheet-limit-keeps-keyboard-focus.e2e.ts --target web with the repro scenario added: it failed in 2 of 2 runs on a clean boat.dev VM, with expected "Focus left the preview" to be "Focus is in the preview" in the output.
Evidence#
Environment: Linux x64 on a boat.dev VM reset before each run, the repository's own tests.
Proven: the replacement test apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx fails at the test commit 4e1044afd3 and passes on the head f90452e645, both on main 3eb5894919.
| Before | After | |
|---|---|---|
| Commit | 4e1044afd3 | f90452e645 |
| Result | failed with "expected 'Focus left the preview' to be 'Focus is in the preview'" | passed |
| last sheet after keyboard navigation | ![]() The second sheet opens, but focus leaves the spreadsheet preview. | ![]() The second sheet opens and keyboard focus stays in the spreadsheet preview. |
| failure | ![]() | |
| Recording | Before: recording | After: recording |
Tests#
- 4e1044afd3 adds the failing test, alone, before the fix.
pnpm exec vp run check:changed 3eb58949194ce010be0af51d861d3292127e8a37passed on head.
Not in this change#
- The OpenXML viewers (xlsx/pptx/docx in office/Presentation.tsx and office/Spreadsheet.tsx) have their own step buttons and are not changed here.
- EPUB viewer navigation is not changed.
Who did the work#
- Repro written by GPT 6.2 Sol, in Codex
- Written by Claude Opus 5.5, in Claude Code
- Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex
- Reproduction, checks and proof run by a program on base and head, not by an agent
Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5
- 1
- 2
Pushed532377c
The automated pipeline ran the reported steps in the real app without this change, and the problem did not appear. So it cannot show that this change fixes anything.
What was run on
9a08ffb840, the commit before this change:On each commit: create sample-project with report.ods containing Overview and Details sheets; open a new thread; open the right panel and Files tab; open report.ods; focus Next sheet while on Overview; press Enter; wait for Details. The scenario asserted that focus remained inside the preview container and matched :focus-visible, then captured the last-sheet state.
How: Real T3 Code web app via scenarios:prove, Chromium browser at 1440x1000, fresh scenario database with a synthetic two-sheet report.ods seeded through t3.project; opened through the Files panel.
Closing this pull request. If you can share the exact steps, what you see, and the version and platform you are on, it can be reopened.
juliusmarminge closed this
juliusmarminge removed labelstakeover:in-progress
juliusmarminge added labelstakeover:blocked
Sign in to join this conversation.





macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes