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
{{ message }}
Repository navigation
fix(web): Esc in Find in PDF clears it without closing the sheet - #41749
When a PDF opens in the built-in PDF.js viewer (the desktop app, or any browser without a native PDF viewer), pressing Esc in Find in PDF closes the whole Files sheet or attachment preview instead of clearing the search. The input had no Escape handling, so the key reached the sheet's dismiss handler. Because it was type="search", the browser also cleared it on an Escape that only ends an IME composition.
Fix
The same fix as #41616 for the Files search: the input is now type="text" with role="searchbox" (same accessible name), and its Escape handler clears a non-empty query and stops the key there. A second Esc on the empty field still closes the sheet. IME Escapes (isComposing or keyCode 229) are left alone. Held-down Esc repeats are also stopped, as in #41692, so holding Esc clears the query without also closing the sheet.
Evidence
Setup: Linux, vp run dev --no-seed with isolated state, T3's Browser panel (Chromium reports navigator.pdfViewerEnabled === false, so BrowserDocumentFrame mounts the PDF.js PdfViewer). Window 900px wide so the right panel opens as a sheet. A two-page text PDF in a test project.
Steps: Open the right panel → Files → planning.pdf, type budget in Find in PDF, press Esc.
Before
After
Query typed (same on both)
After one Esc
On the fixed build, a second Esc closed the sheet.
Tests
New PdfViewer.browser.test.tsx case renders the viewer inside RightPanelSheet: IME Escapes keep the query, the first Esc clears it without closing the sheet, a repeat Esc does not close it, and the next Esc closes it. Fails on main, passes here.
vp test run apps/web/src/components/files/PdfViewer.browser.test.tsx (7 passed), vp run check:changed passes.
Reviewing files that changed from the base of the PR and between 6a8be8a and 7ad1ca1.
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
The PDF search field now preserves its query during IME composition. Escape clears a non-empty query without closing the panel. A later Escape closes the panel.
Changes: PDF Search Escape Handling
Layer / File(s)
Summary
Search field Escape behavior apps/web/src/components/files/PdfViewer.tsx, apps/web/src/components/files/PdfViewer.browser.test.tsx
The search field uses a text input with the searchbox role. Escape does not clear the query during IME composition. A normal Escape clears a non-empty query and stops propagation. Browser tests check composition ordering, query clearing, and panel closure on a subsequent Escape.
This change makes Escape in the Find in PDF field clear the query before closing the sheet, and it leaves IME composition alone. No actionable merge risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(web): Esc in Find in PDF clears it without closing the sheet" names the main change: Escape in the PDF Find field now clears the query and no longer closes the Files sheet. It matches t…
Description check
The description covers the required template sections. Problem is explained with expected behavior and environment (Linux, PDF.js viewer, Chromium with navigator.pdfViewerEnabled false). Change explai…
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): Esc in Find in PDF clears it without closing the sheet" names the main change: Escape in the PDF Find field now clears the query and no longer closes the Files sheet. It matches the changeset (PdfViewer.tsx Escape handling and the new browser test) and follows the conventional commit format from the template.
Full details: Description check
Explanation
The description covers the required template sections. Problem is explained with expected behavior and environment (Linux, PDF.js viewer, Chromium with navigator.pdfViewerEnabled false). Change explains the type and role update, the Escape handler, IME handling, and repeat handling. Scope explains the bug fix and references related issues #41616 and #41692. Verification lists the new browser test, the vp test run result (7 passed), check:changed, and before/after screenshots. Minor gap: the Scope section does not link a dedicated issue for this bug. It also does not state the agent model in the required form, though it names one.
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; 5 remain after this review.
Open a seeded thread at 900×800 in light theme → Toggle right panel → Files → search for and open plan.pdf → enter budget in Find in PDF → wait for 1/1 → press Escape.
On head, repeat Escape retains the sheet; a fresh second Escape dismisses it. The scenario failed on base because Find in PDF disappeared after the first Escape, and passed on head.
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
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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.
When a PDF opens in the built-in PDF.js viewer (the desktop app, or any browser without a native PDF viewer), pressing Esc in Find in PDF closes the whole Files sheet or attachment preview instead of clearing the search. The input had no Escape handling, so the key reached the sheet's dismiss handler. Because it was
type="search", the browser also cleared it on an Escape that only ends an IME composition.Fix
The same fix as #41616 for the Files search: the input is now
type="text"withrole="searchbox"(same accessible name), and its Escape handler clears a non-empty query and stops the key there. A second Esc on the empty field still closes the sheet. IME Escapes (isComposingorkeyCode229) are left alone. Held-down Esc repeats are also stopped, as in #41692, so holding Esc clears the query without also closing the sheet.Evidence
Setup: Linux,
vp run dev --no-seedwith isolated state, T3's Browser panel (Chromium reportsnavigator.pdfViewerEnabled === false, soBrowserDocumentFramemounts the PDF.jsPdfViewer). Window 900px wide so the right panel opens as a sheet. A two-page text PDF in a test project.Steps: Open the right panel → Files →
planning.pdf, typebudgetin Find in PDF, press Esc.On the fixed build, a second Esc closed the sheet.
Tests
PdfViewer.browser.test.tsxcase renders the viewer insideRightPanelSheet: IME Escapes keep the query, the first Esc clears it without closing the sheet, a repeat Esc does not close it, and the next Esc closes it. Fails onmain, passes here.vp test run apps/web/src/components/files/PdfViewer.browser.test.tsx(7 passed),vp run check:changedpasses.Generated with Claude Opus 5.5 in T3 Code Nightly