You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a keyboard user opens a folder or file in the Files panel archive preview (.tar, .tar.gz, .zip), or returns to root (Parent folder, or Back to archive from a root file), focus jumps to Search <project> files because the focused button unmounts or disables, dropping focus to document.body.
Change
BinaryViewer commits archive navigation with flushSync, focuses the enabled header button (archiveHeaderRef) when opening a folder or file, and focuses the archive list (archiveListRef) when going back disables it at root (leaving it focused when enabled); if a target cannot take focus, focus is a no-op and workspace focus recovery stays untouched.
Scope
Small bug fix in BinaryViewer.tsx with one browser test; no issue needed.
Verification
Setup: Linux x64, real web app in isolated homes, Chromium 1280×800 light, keys sent through the debugging port, synthetic repo (archive.tar via tar, archive.zip via zip, readme.txt), Replay (dev) (multi-turn).
Steps: Files -> archive.tar -> Enter docs -> sub -> Parent folder -> notes.txt -> Back to archive -> Parent folder -> hello.txt -> Back to archive.
Not shown:docs/sub/ open/back, Back to archive in docs/, root hello.txt open/back, archive.zip, pointer clicks, intentional search focus, readme.txt.
Automated checks
Browser test failed on base 974e833c6ea3 (Expected element with focus: Parent folder, got <body>) and passed 200/200 on head 278b2711f35e (2×100 concurrent runs).
vp run check:changed 974e833c6ea3e42b1df55f1da98c6eaef6c3a6de: format, lint, knip, typecheck (2 packages), AttachmentFilePreview.browser.test.tsx (111/111), React Compiler (BinaryViewer.tsx) passed.
Entering an archive folder or opening an archived file previously unmounted the focused row button, and returning to the archive root disabled the header back button, dropping focus to document.body where workspace focus recovery moved it to the file explorer search box.
Commit archive navigation state synchronously with flushSync, move focus to the enabled header back button when opening a folder or file, and move focus to the archive list container when navigating back to the archive root disables the header button.
Macroscope's review found this PR approvable — Archive preview navigation now keeps keyboard focus within the preview instead of losing it when controls unmount or become disabled. The change is limited to local UI state and focus handling, with reported browser verification covering the affected navigation.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between 278b271 and 3f03576.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Archive navigation now updates state synchronously. Focus moves to the archive header after opening a row and to the archive list when back navigation reaches the root. A browser test checks keyboard focus when opening a folder.
Changes: Archive navigation and focus
Layer / File(s)
Summary
Synchronous navigation and focus management apps/web/src/components/files/BinaryViewer.tsx, apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
Archive row and back actions update state synchronously. Opening a row moves focus to the first enabled archive-header button. Back navigation focuses the archive list when it reaches the root. The browser test checks that pressing Enter on a folder moves focus to the “Parent folder” button.
This change keeps keyboard focus on the archive controls when navigating archive previews. No concrete merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(web): archive preview keeps keyboard focus when navigating" names the main change. The diff makes BinaryViewer commit archive navigation with flushSync and move focus to the header butt…
Description check
The description follows the template sections Problem, Change, Scope, and Verification. It explains the focus loss bug with reproduction steps. It states the fix in BinaryViewer.tsx and explains why n…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(web): archive preview keeps keyboard focus when navigating" names the main change. The diff makes BinaryViewer commit archive navigation with flushSync and move focus to the header button or archive list when opening a folder or file or returning to root. The title also follows the conventional commit format the template suggests.
Full details: Description check
Explanation
The description follows the template sections Problem, Change, Scope, and Verification. It explains the focus loss bug with reproduction steps. It states the fix in BinaryViewer.tsx and explains why no issue is needed. Verification includes a before/after table with screenshots, the browser test result, and the commands run. Items the author did not check are listed. The template's optional model/harness attribution is present. The only gaps are minor: the Change section does not explain why the archive list focus fallback is correct beyond the summary, and the Scope section does not link a maintainer request, which is not required here.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Real web app in Chromium 156 on Linux, 1920×1080, light theme, local connection. Each commit ran from its own checkout against a fresh isolated database. The same driver seeded a synthetic ZIP and replay thread, opened the Files panel, and widened the preview equally on both sides. Every still was checked against an identical capture 500 ms apart.
Open sample.zip from the Files panel; focus Save file, press Tab and Enter to open docs; focus sub and press Enter; Enter on Parent folder to return to docs; Enter on notes.txt; Enter on Back to archive; Enter on Parent folder to reach root; Enter on hello.txt; Enter on Back to archive to reach root. Each named control was focused before Enter, and document.activeElement was read before assigning focus for the next step.
The base drops focus out of the preview on all six reported broken transitions; workspace recovery focuses Search files (visible in the captures). The head focuses Parent folder or Back to archive when opening entries and the archive list when returning to root. The two already-working transitions within docs retain header focus on both sides.
Run the driver separately in each checkout with PROOF_CAPTURE_ROOT=.e2e/capture T3CODE_DEV_SEED=0 vp run scenarios scenarios/archive-preview-focus-proof.e2e.ts --target web --output .e2e/capture. No scenario or capture was committed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a keyboard user opens a folder or file in the Files panel archive preview (
.tar,.tar.gz,.zip), or returns to root (Parent folder, orBack to archivefrom a root file), focus jumps toSearch <project> filesbecause the focused button unmounts or disables, dropping focus todocument.body.Change
BinaryViewercommits archive navigation withflushSync, focuses the enabled header button (archiveHeaderRef) when opening a folder or file, and focuses the archive list (archiveListRef) when going back disables it at root (leaving it focused when enabled); if a target cannot take focus,focusis a no-op and workspace focus recovery stays untouched.Scope
Small bug fix in
BinaryViewer.tsxwith one browser test; no issue needed.Verification
Setup: Linux x64, real web app in isolated homes, Chromium 1280×800 light, keys sent through the debugging port, synthetic repo (
archive.tarviatar,archive.zipviazip,readme.txt),Replay (dev)(multi-turn).Steps: Files ->
archive.tar-> Enterdocs->sub->Parent folder->notes.txt->Back to archive->Parent folder->hello.txt->Back to archive.974e833c6ea3278b2711f35edocsFocus in Search files
Focus on Parent folder
notes.txtFocus in Search files
Focus on Back to archive
Parent folderFocus in Search files
Focus moves to archive list
Not shown:
docs/sub/open/back,Back to archiveindocs/, roothello.txtopen/back,archive.zip, pointer clicks, intentional search focus,readme.txt.Automated checks
974e833c6ea3(Expected element with focus: Parent folder, got<body>) and passed 200/200 on head278b2711f35e(2×100 concurrent runs).vp run check:changed 974e833c6ea3e42b1df55f1da98c6eaef6c3a6de: format, lint, knip, typecheck (2 packages),AttachmentFilePreview.browser.test.tsx(111/111), React Compiler (BinaryViewer.tsx) passed.Generated with Gemini 4 Neon in T3 Code Nightly