Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): image zoom buttons keep keyboard focus at their limits #48135

ClosedStiensWout(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/48135/headopened View on GitHub

In the Files image preview, pressing Zoom in or Zoom out until the zoom limit disabled the focused button, and the browser dropped keyboard focus out of the preview (sometimes into the file search box). The image viewport is now a focusable, labelled region. When a zoom step reaches the limit in its own direction (800% for Zoom in, 5% for Zoom out), focus moves to that region before the button disables. This matches how the PDF viewer already handles its zoom and page limits.

Related: #47774, #47762, #34394

Reproduction on main

Commit cc19795ea7 (main). The image reaches 800%, and focus leaves the preview. With Files open, it can land in the file search box. Expected: Focus stays inside the image preview so keyboard navigation can continue there.

  1. Open a small workspace image from the Files panel.
  2. Tab to Zoom in.
  3. Press Enter repeatedly until the zoom reaches 800%.

The cause is at apps/web/src/components/files/PreviewImageContent.tsx:69. Ran pnpm scenarios:prove scripts/scenarios/image-zoom-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/PreviewImageContent.browser.test.tsx fails at the test commit a789033b92 and passes on the head 18ea01898f, both on main 3eb5894919.

BeforeAfter
Commita789033b9218ea01898f
Resultfailed with "expected 'Focus left the preview' to be 'Focus is in the preview'"passed
image at maximum zoomBefore: image at maximum zoom Before: image at maximum zoom (changed region)
The image reaches 800%, and focus leaves the preview. With Files open, it can land in the file search box.
After: image at maximum zoom After: image at maximum zoom (changed region)
Focus stays inside the image preview so keyboard navigation can continue there.
failureBefore: failure
RecordingBefore: recordingAfter: recording

Tests

  • a789033b92 adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed 3eb58949194ce010be0af51d861d3292127e8a37 passed on head.

Not in this change

  • Other FileSurfaceAction buttons that disable themselves (DocumentPages reading size, BinaryViewer parent folder, Save file) can still drop focus at their limits.
  • The PDF viewer already handles this case and is unchanged.

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. Pushed35a8e1f

    2. The automated pipeline stopped on this pull request and will not merge it:

      the fix is written and reviewed, but proving it needs something no worker has:

      • Permanent blocker: the prescribed real-app scenario could not start consistently because the runner reported different devReplay advertised model catalogs on the base and head runs; no valid before/after captures were produced.
      • The scenario file was not uploaded because it did not produce proof captures.

      It stays open for a person to finish or close.

    3. juliusmarminge added labelstakeover:blocked

    4. juliusmarminge removed labelstakeover:in-progress

Sign in to join this conversation.