Repository navigation
fix: restore focus after closing file search - #154221
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 10:53 PM ET / September 21, 2026, 02:53 UTC (Revision 4). ClawSweeper reviewWhat this changesRestores keyboard focus after closing file-preview search, documents that behavior, and repairs locale cleanup and pointer positioning in UI tests. Merge readiness✅ Ready for maintainer review The fix remains useful on inspected main. The latest commit addresses the previous review’s test blocker, and no blocking correctness or security findings remain. Priority: P3 Review scores
Verification
How this fits togetherThe Control UI’s file-preview panel owns in-file search and keyboard navigation. Search input updates highlighted matches; closing search should return focus to the persistent toolbar. flowchart LR
A[File preview] --> B[Search field]
B --> C[Highlighted matches]
B --> D[Escape key]
D --> E[Close and clear search]
E --> F[Focus search toolbar button]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +1, Tests +106, Docs 0. Total +107 across 7 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep search dismissal within the existing panel owner and restore focus synchronously to its persistent toolbar control. Do we have a high-confidence way to reproduce the issue? Yes: open file-preview search and press Escape; inspected main removes the focused input without selecting a replacement. The supplied Chrome observations corroborate this path; this review did not execute it. Is this the best way to solve the issue? Yes: the patch reuses the existing close path and focuses a persistent control before rendering removes the input, avoiding delayed focus theft. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 46e56ca97d44. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
* fix: restore focus after closing file search * test: restore document locale after isolated managers * test: position pointer before model-search Escape checks
What Problem This Solves
Fixes: pressing Escape in a file preview's search field loses keyboard focus when the field disappears.
User Impact
Escape returns focus to Search in file, so keyboard users can reopen search or continue through the file toolbar. File contents and saved drafts are unchanged.
Why This Change Was Made
The file panel already owns search visibility and query cleanup. Escape now uses that close path and synchronously focuses the persistent toolbar button before the input is removed, avoiding delayed focus that could interrupt navigation.
The first CI run also exposed a shared-test locale leak: a separate translation manager left the document in German, while restoring an already-English singleton skipped document synchronization. The existing test cleanup helper now restores the exact language and direction attributes along with locale and persisted preference. Production locale handling and Workboard assertions are unchanged.
The next CI run exposed a model-picker test race: clearing the search moved a model row under the stationary pointer, which opened a tooltip that correctly consumed the next Escape. The test now clicks into search and waits for row tooltips to close before exercising clear-then-dismiss. Picker behavior, Escape precedence, assertions, and deadlines are unchanged.
Evidence
fece4c4f291apassed in 278.6 s. The task Gateway serves the verified new bundle; live Chrome confirms that Unicode search still finds its match, Escape focuses the toolbar button, Enter reopens a focused empty search field, and Escape restores focus again.The locale defect reproduces in the exact predecessor-to-Workboard order: four producer cases pass and two clock cases fail with German minute abbreviations. The helper repair passes that unchanged order three times, all 20 standalone regression runs, and 180 related cases. The full original 464-file UI shard passes 7,711 cases with one skip in 199.33 seconds; four newer-main sibling cases are outside this source checkpoint and will run in hosted merge CI.
The model-picker failure reproduces when the naturally hovered row tooltip opens before the second Escape; that key closes the tooltip and leaves the picker open. After moving the pointer into search, all 20 fresh two-case runs pass, followed by three complete 13-case runs and the original 51-file CI shard (264 cases; 313.50 seconds Vitest / 314.98 seconds process). Tooltip-first Escape coverage remains unchanged.
Before Escape dismissed search and left focus on the page body:
After Escape returns focus to Search in file, showing its keyboard focus ring: