Repository navigation
fix: keep a side-panel file open on escape typed in its editor - #31653
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks: this changes only keyboard handling and adds or changes no visible control, so no screenshot is needed. [UX-REVIEWED] 10db7f4 Description read[DESCRIPTION-READ] 944817b17fb135d9b2ec2ba16234ef746336ef011ff3313f65eaa329b8a864bb That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (3 items) — 3 justifiedIntent: let someone press Escape while editing a side-panel file without the file closing. This is a FIX (#23975).
[FIRST-PRINCIPLES-REVIEWED] 10db7f4 Description read[DESCRIPTION-READ] fdc2abd75df76216ce7d289b804c799283452de5e5b78c302c35ba2b49ad16b9 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the change is a narrow guard on the existing Escape handler, it renders nothing new, and it is reverted by removing one line. Notes
[DESIGN-REVIEWED] 10db7f4 Description read[DESCRIPTION-READ] 40a0be7fc8e0ed2d5622db949648363143ae99e5bb68b1effb717ae23a3665a5 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Escape typed into an editable field of a side-panel file tab (the code editor, or the Files rail's filter) no longer closes the file. The tab listened for Escape on the whole page and the editor does not claim the key, so a press meant for the editor closed the file mid-edit. Escape from anywhere else, the chat composer included, still closes it. Closes #23975
8cbf23a to
10db7f4
Compare
|
Rebased: main moved in website/src/components/MarkdownPanel.tsx and docs/system-specs/modules/learn-cron-dashboard.md since this head's CI ran (90a555f -> a47c2d4); CI re-running. The previous run's only red, [operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved for the on-call. Review lanes pass on 10db7f4, no conflict, no open change request.
Escape typed into an editable field of a side-panel file tab (the code editor, or the Files rail's filter) no longer closes the file. The tab listened for Escape on the whole page and the editor does not claim the key, so a press meant for the editor closed the file mid-edit. Escape from anywhere else, the chat composer included, still closes it. Closes #23975 (cherry picked from commit 27fce31) Original author: Bolin Chen (#31653). Hand-resolved, docs/tests only: docs/system-specs/modules/learn-cron-dashboard.md keep release's structure plus this commit's added and removed lines.
Escape typed into an editable field of a side-panel file tab (the code editor, or the Files rail's filter) no longer closes the file. The tab listened for Escape on the whole page and the editor does not claim the key, so a press meant for the editor closed the file mid-edit. Escape from anywhere else, the chat composer included, still closes it. Closes #23975 (cherry picked from commit 27fce31) Original author: Bolin Chen (#31653). Hand-resolved, docs/tests only: docs/system-specs/modules/learn-cron-dashboard.md keep release's structure plus this commit's added and removed lines.
Problem / Motivation
Goal: Pressing Escape while typing in a side-panel file's code editor no longer closes the file.
With a file open in the side panel's code editor, pressing Escape closes the file, or raises the "Discard unsaved changes?" prompt when the buffer has edits, even though the caret is in the editor.
Why it matters
Escape is an everyday key while editing: people press it out of habit from other editors to drop a selection or leave a mode. Every such press throws them out of the file they are working in. A clean file closes with no prompt and the reader's place is lost; an edited one interrupts the typing with a discard dialog.
Not a goal
What changed (motivation → approach → change)
The side-panel file tab listens for Escape on the whole page and closes its file, and the code editor does not claim the key, so a press typed into the editor reached that close. The Files rail's filter beside it had the same problem: its Escape cleared the filter and closed the file too.
In
MarkdownPanel.tsxthe close now leaves a press alone when it was typed into an editable field inside the panel's own content row: the code editor above all, and the Files rail's filter. It asksisEditableTargetand checks the event's composed path for that row, because the editor's editable node sits in a shadow root. Escape from a button in the panel, or from anywhere outside it (the chat composer beside the panel included), still closes the file through the same guard.The side-panel file tab paragraph in
learn-cron-dashboard.mdrecords the rule, andMarkdownPanel.escape.test.tsxpins it.Backwards compatibility
Compatible: every way to close the file still works: Escape pressed outside an editable field of the panel, the panel's ×, and the tab chip's × and middle-click; full screen still leaves on Escape.
Reader: website/src/components/MarkdownPanel.tsx:guardedClose -- entry: chat -- still reached from Escape outside a field and from the × (MarkdownPanel.escape.test.tsx, MarkdownPanelCoverage.test.tsx "routes Escape through the same discard guard as the close button")
Reader: website/src/components/chat-input/escapeOwners.ts:anotherEscapeOwnerIsOpen -- entry: chat -- the open file still marks itself
data-escape-owner, so the composer's stop and dictation gates yield exactly as beforeReader: website/src/pages/chat/FileBrowserRail.tsx:FileBrowserRail -- entry: chat -- its filter still clears on Escape (FileBrowserRail.test.tsx "clears the query on Escape"); leaving the field is now what closes the file
Tests
website/src/test/MarkdownPanel.escape.test.tsxmounts the panel on a code file with its editor (Pierre stubbed as a textarea), a Files rail holding a filter input and a button, and a composer textarea outside the panel. Escape typed in the editor or the filter leaves the file open; Escape on the rail's button closes it, and so does Escape typed in the composer. It fails on main (onClosecalled twice before the first assertion), and with the guard line removed.Proof: not provable -- frontend test (prove.py runs Python only)
Determinism: 20 isolated runs green, then 5 runs with
--sequence.shuffle(seeds 24362 to 24366) besideMarkdownPanelFindEscape.test.tsxandMarkdownPanel.editFocus.test.tsxat--maxWorkers=4, all green. The assertions are synchronous: a clean, unwatched buffer closes without an await.The panel's other suites (every
MarkdownPanel*spec, the side-panel tab-chip close specs,FileBrowserRail.test.tsx,stopButtonEscalation.test.tsx,editableTarget.test.ts) pass unchanged.Manual verification
Not run in a browser. The test drives the panel's real document handler. In a real engine the editor's editable node is inside an open shadow root, and
composedPath()lists both it and the panel's content row, which is the same readisEditableTargetalready relies on for this editor.Screenshots / video
Why no screenshot: Keyboard handling only: nothing on screen renders differently, a key press simply stops closing the file.
Related Issues
Closes #23975
Sibling sweep
Swept: git grep -l -E "ContentRenderer|CodeEditor|EditableCodeBlock" -- website/src, then each hit's Escape handling, plus every field inside the panel's content row
Sibling: website/src/pages/chat/FileBrowserRail.tsx:708 -- not affected -- its filter sits inside the panel's content row, so the one MarkdownPanel.tsx guard covers it
Sibling: website/src/components/ArtifactPanel.tsx:289 -- not affected -- its Escape handler already returns on an editable target
Sibling: website/src/components/library/SessionDocPreview.tsx -- not affected -- mounts ContentRenderer with editing={false}, no file editor
Sibling: website/src/apps/aws-control/DrivePageFileDialogs.tsx -- not affected -- its preview never mounts the editing surface
Pattern harvest
Rule candidate: review-prompt
Pattern: a page-level Escape handler that closes a surface does not ask isEditableTarget for a field inside that surface
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.