Repository navigation
fix(ui): file search skips the first match when Enter confirms IME input in Safari - #196151
Conversation
…earch match The Find in file search of the chat Details file viewer moved to the next match on every Enter, including the Enter that confirms IME composition, so CJK input started at the second match. The search keydown handler now lets composition Enters through with the shared IME helper, and both the desktop and mobile search inputs record compositionend for it. A plain Enter still moves to the next match.
|
🦞👀 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. What this changesThis PR prevents Enter used to confirm IME input from advancing file-search matches on desktop and mobile. Example: Search search.json for 雪 using Japanese IME when three lines match.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a current file-search bug with a small, coherent patch and convincing runtime evidence; no actionable code defects were found, but exact-head CI has not completed successfully. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI file reader passes desktop and mobile search events to shared presentation actions, which update the selected match and editor highlighting. flowchart LR
A[Desktop search input] --> C[Shared IME helper]
B[Mobile search input] --> C
C --> D[File presentation actions]
D --> E[Match selection and highlighting]
Technical reviewBest possible solution: Land the existing shared-helper integration after the required CI gate succeeds. Do we have a high-confidence way to reproduce the issue? Current main exposes the unguarded Enter path, and supplied Safari screenshots plus exact-head WebKit reports establish the failure and correction; no target code was executed during this review. Is this the best way to solve the issue? This is the smallest complete production fix: retain the existing search owner, reuse its shared IME policy, and wire both independently rendered inputs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 81ab38df631c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +12, Tests -2. Total +10 across 4 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 9, 2026, 1:28 PM ET / 18:28 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Proof on a real Gateway (secretless Docker, node 24.22.1, built Gateway serving the built Control UI). A chat file link opens WebKit (Playwright WebKit, headed under Xvfb): the query is typed through a real GTK input method composition (Ctrl+Shift+U
Same on desktop and mobile. Controls, same on both refs in every run:
Control UI gzip (repo performance check, candidate against main): chat boot +0 B and startup +0 B. Served gzip, which includes hash noise: +139 B in total. Changes on top of the contributor's fix (production code unchanged): I replaced the new 36-line test with IME steps inside existing tests. The search keyboard test now covers the mobile input, and the desktop SVG search step covers the desktop input. I also removed a few redundant lines. Both folded steps fail on main ( Screenshots: main and candidate right after the IME-confirming Enter, desktop and mobile. |
|
Landed in e2320c3. Thanks @masatohoshino. Confirming an IME word with Enter in Safari no longer skips the first file search match. |
…put in Safari (#196151) fix(ui): file search skips the first match when Enter confirms IME input in Safari In the chat file viewer's Search in file, Safari sends the Enter that confirms an IME word after the composition has ended, with the composition flags already cleared. The search treated it as a plain Enter and jumped to the second match. The desktop and mobile search inputs now use the existing ime.ts guard, so the confirming Enter keeps the first match and the next plain Enter advances. Evidence: a built Gateway and Control UI on node 24.22.1 in Docker, opening a real chat file link. Playwright WebKit typed 雪 through a real GTK input method, then a trusted Enter arrived 28 to 79 ms after the composition ended (Safari's order). On main the confirming Enter jumped to 2/3 on desktop and mobile (two runs). With this change it stays on 1/3 and a plain Enter moves to 2/3. Plain Enter, Shift+Enter, clearing and Escape are identical on both, and Chromium ends at the same match on both. Control UI gzip: +0 B. Details: openclaw/openclaw#196151 (comment). Before (main, desktop): the confirming Enter lands on 2/3.  After (desktop): it stays on 1/3.  Before (main, mobile): 2/3.  After (mobile): 1/3.  Thanks @masatohoshino. Co-authored-by: Ayaan Zaidi <[email protected]>
…put in Safari (#196151) fix(ui): file search skips the first match when Enter confirms IME input in Safari In the chat file viewer's Search in file, Safari sends the Enter that confirms an IME word after the composition has ended, with the composition flags already cleared. The search treated it as a plain Enter and jumped to the second match. The desktop and mobile search inputs now use the existing ime.ts guard, so the confirming Enter keeps the first match and the next plain Enter advances. Evidence: a built Gateway and Control UI on node 24.22.1 in Docker, opening a real chat file link. Playwright WebKit typed 雪 through a real GTK input method, then a trusted Enter arrived 28 to 79 ms after the composition ended (Safari's order). On main the confirming Enter jumped to 2/3 on desktop and mobile (two runs). With this change it stays on 1/3 and a plain Enter moves to 2/3. Plain Enter, Shift+Enter, clearing and Escape are identical on both, and Chromium ends at the same match on both. Control UI gzip: +0 B. Details: openclaw/openclaw#196151 (comment). Before (main, desktop): the confirming Enter lands on 2/3.  After (desktop): it stays on 1/3.  Before (main, mobile): 2/3.  After (mobile): 1/3.  Thanks @masatohoshino. Co-authored-by: Ayaan Zaidi <[email protected]>
…put in Safari (#196151) fix(ui): file search skips the first match when Enter confirms IME input in Safari In the chat file viewer's Search in file, Safari sends the Enter that confirms an IME word after the composition has ended, with the composition flags already cleared. The search treated it as a plain Enter and jumped to the second match. The desktop and mobile search inputs now use the existing ime.ts guard, so the confirming Enter keeps the first match and the next plain Enter advances. Evidence: a built Gateway and Control UI on node 24.22.1 in Docker, opening a real chat file link. Playwright WebKit typed 雪 through a real GTK input method, then a trusted Enter arrived 28 to 79 ms after the composition ended (Safari's order). On main the confirming Enter jumped to 2/3 on desktop and mobile (two runs). With this change it stays on 1/3 and a plain Enter moves to 2/3. Plain Enter, Shift+Enter, clearing and Escape are identical on both, and Chromium ends at the same match on both. Control UI gzip: +0 B. Details: openclaw/openclaw#196151 (comment). Before (main, desktop): the confirming Enter lands on 2/3.  After (desktop): it stays on 1/3.  Before (main, mobile): 2/3.  After (mobile): 1/3.  Thanks @masatohoshino. Co-authored-by: Ayaan Zaidi <[email protected]>
…put in Safari (openclaw#196151) fix(ui): file search skips the first match when Enter confirms IME input in Safari In the chat file viewer's Search in file, Safari sends the Enter that confirms an IME word after the composition has ended, with the composition flags already cleared. The search treated it as a plain Enter and jumped to the second match. The desktop and mobile search inputs now use the existing ime.ts guard, so the confirming Enter keeps the first match and the next plain Enter advances. Evidence: a built Gateway and Control UI on node 24.22.1 in Docker, opening a real chat file link. Playwright WebKit typed 雪 through a real GTK input method, then a trusted Enter arrived 28 to 79 ms after the composition ended (Safari's order). On main the confirming Enter jumped to 2/3 on desktop and mobile (two runs). With this change it stays on 1/3 and a plain Enter moves to 2/3. Plain Enter, Shift+Enter, clearing and Escape are identical on both, and Chromium ends at the same match on both. Control UI gzip: +0 B. Details: openclaw#196151 (comment). Before (main, desktop): the confirming Enter lands on 2/3.  After (desktop): it stays on 1/3.  Before (main, mobile): 2/3.  After (mobile): 1/3.  Thanks @masatohoshino. Co-authored-by: Ayaan Zaidi <[email protected]>
fix(ui): keep Ask OpenClaw drafts when Enter confirms IME input In Ask OpenClaw (the Custodian), the composer checked only `event.isComposing`, so an Enter that confirms Chinese or Japanese IME input and arrives as keyCode 229 or right after `compositionend` (the Safari/WebKit order) submitted the unfinished instruction and cleared the draft. The composer now uses the shared `ui/src/lib/ime.ts` guard, as the chat composer and the earlier fixes #195983 and #196151 do. The setup screen's sensitive composer gets the same guard; the current wizard always sends a step there, so that path has no live route and only its unit contract is covered. No new text. Control UI gzip grows by +416 B (startup + chat boot), within the bug-fix allowance; override receipt on the PR. Evidence: Control UI served from source by an isolated loopback Gateway; Playwright Chromium composing CJK text through CDP, twice per side, plus one WebKit 27.2 run per side (harness-only PushAPIEnabled=false). Base: the confirming Enter (keyCode 229, and Enter right after compositionend) sends the unfinished text and clears the draft; this change keeps the draft, and a following plain Enter sends it once. Gateway request counts confirm both. Plain Enter and Shift+Enter behave the same on both. Unit: three cases fail on base, 30 pass here. Screenshots and receipts: #199638 (comment). Thanks @zhangguiping-xydt. Co-authored-by: Ayaan Zaidi <[email protected]>
…w#199638) fix(ui): keep Ask OpenClaw drafts when Enter confirms IME input In Ask OpenClaw (the Custodian), the composer checked only `event.isComposing`, so an Enter that confirms Chinese or Japanese IME input and arrives as keyCode 229 or right after `compositionend` (the Safari/WebKit order) submitted the unfinished instruction and cleared the draft. The composer now uses the shared `ui/src/lib/ime.ts` guard, as the chat composer and the earlier fixes openclaw#195983 and openclaw#196151 do. The setup screen's sensitive composer gets the same guard; the current wizard always sends a step there, so that path has no live route and only its unit contract is covered. No new text. Control UI gzip grows by +416 B (startup + chat boot), within the bug-fix allowance; override receipt on the PR. Evidence: Control UI served from source by an isolated loopback Gateway; Playwright Chromium composing CJK text through CDP, twice per side, plus one WebKit 27.2 run per side (harness-only PushAPIEnabled=false). Base: the confirming Enter (keyCode 229, and Enter right after compositionend) sends the unfinished text and clears the draft; this change keeps the draft, and a following plain Enter sends it once. Gateway request counts confirm both. Plain Enter and Shift+Enter behave the same on both. Unit: three cases fail on base, 30 pass here. Screenshots and receipts: openclaw#199638 (comment). Thanks @zhangguiping-xydt. Co-authored-by: Ayaan Zaidi <[email protected]>




Closes #196150
What Problem This Solves
Fixes: Search in file in the Control UI chat file viewer skips the first match when the Enter that confirms IME composition arrives in WebKit's event order (seen in Safari).
User Impact
User impact: in Safari, a search typed with an input method (Japanese, Chinese, Korean and similar) now starts on the first match, and a plain Enter still moves to the next match. iOS browsers use WebKit too and should get the same fix; that was not tested on a device.
Why This Change Was Made
WebKit can deliver the committing Enter after
compositionendwith both composition flags cleared, so the file search keydown handler treated it as a plain Enter and ran Next match. The Control UI already handles this order in its shared IME helper (ui/src/lib/ime.ts), as the Usage query field does since #195087. The file search now uses the same helper: the keydown handler leaves composition Enters alone, and the desktop and mobile search inputs recordcompositionendfor it.In Chrome the old behavior was not visible, because the commit's
inputevent resets the search to the first match after the composing Enter; the change keeps that path as it was.Evidence
Tested at
2651428ed6e9553f266c628e656d139238226b9e(baseupstream/main333dc30679c956a334d3ae1fc9222581a2be323a).Real Safari 27.0 on macOS 15.8.1 with the macOS Japanese Romaji input method; keys sent as real key events through the input method (no synthetic DOM or devtools events). An isolated Gateway with its own state directory and port served a Control UI built from the base or from this branch; the served bundles' source maps were checked against both commits. Flow: chat Details file viewer,
search.jsonwith three lines containing雪, File actions, Search in file. Steps: typeyuki(composes雪), Return (confirms it), Return, Return. Each side ran twice with the same counters.Before (base
333dc30679c), runs 1 and 2:After (this PR), runs 1 and 2:
Observed result: on the base the confirming Enter skips to the second match; with the fix it stays on the first, and plain Enters still step through the matches.
Checks: the touched browser test file, plus the repository's format check, oxlint and
tsgo -p tsconfig.ui.jsonon the touched files; the broad suites run in this PR's CI. The new test fails on the base and passes on this branch (both desktop and mobile cases).pnpm test <file> --maxWorkers=1)ui/src/pages/chat/components/chat-sidebar-file-view.browser.test.tsNot covered: iOS Safari and other iOS browsers were not run on a device (they share WebKit's order but were not observed). The Safari event order is read from the shared IME helper's note and matches the counters; the raw key events were not logged in Safari.
Supporting replay and change size
A Chrome replay with trusted input-method events, desktop and mobile layouts, each scenario twice per side: with the events sent in WebKit's order the base went 1/3, 2/3, 3/3 and this branch 1/3, 1/3, 2/3; in Chrome's own order both sides went 1/3, 1/3, 2/3. This is supporting only; the Safari run above is the proof.
Change size against the merge base: production +12 lines in 3 files (one guard, two input handlers each), test +36 lines in 1 file. A simplify pass removed one comment that restated the guard; the guard and both inputs' composition handlers stay because the mobile and desktop search fields are separate inputs.
Maintainer follow-up
Re-proved in Playwright WebKit with a real input method composition on a built Gateway and Control UI (desktop and mobile, main twice, this head twice, plus controls). The new test was folded into existing tests (test lines net -2), and main was merged. Details and screenshots: #196151 (comment)
Maintainer proof (built Control UI, real Gateway, WebKit IME)
Before (main, desktop): the confirming Enter lands on 2/3.
After (desktop): it stays on 1/3.
Before (main, mobile): 2/3.
After (mobile): 1/3.