Repository navigation
fix(ui): guard personal session group search Enter submit during IME composition - #195983
Conversation
…composition The search box keydown handler early-returned on event.isComposing before the Enter preventDefault, so a committing Enter during IME composition could submit (save) the enclosing form. Only the Escape clear/close path is gated by isComposingKeyboardEvent; Enter's preventDefault is now always applied, which is safe during composition since candidate selection is handled by the input method. Wire recordCompositionEnd/clearCompositionEnd per lib/ime.ts for the WebKit composition-end grace window. Add regression tests covering composition Enter, the WebKit grace window, and composition Escape. Fixes BUG-341
|
🦞👀 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 changesPrevent composing Enter from submitting the section editor while preserving composition-aware Escape handling. Example: Confirm the search term 发布 with Enter in the personal section editor.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness✅ Ready for maintainer review This PR fixes a concrete IME submission bug still present on main; no actionable patch defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI section editor receives browser keyboard events, filters sessions through its existing loader, and submits section changes through the enclosing form. flowchart TD
A[Browser IME input] --> B[Section search handler]
B --> C[Prevent Enter submission]
B --> D[Shared composition guard]
D --> E[Escape clear or close]
B --> F[Session search loader]
Technical reviewBest possible solution: Land the existing focused handler fix and consolidated browser regression once current-head CI passes. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the exact submit path, and the contributor’s inspected Chromium traces demonstrate the base failure and fixed behavior; this review ran no target code. Is this the best way to solve the issue? The smallest complete repair prevents every search Enter from submitting and delegates composing Escape detection to the existing helper, without adding state or another owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3e4e201e11ae. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -2, Tests -4. Total -6 across 2 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. LabelsLabel changes: No label changes. Label justifications:
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 (3 earlier review cycles)
Reviewed November 9, 2026, 10:59 AM ET / 15:59 UTC (Revision 4). |
|
🦞👀 Re-review progress:
|
|
Browser IME proof is now in the PR body and at https://github.com/SunnyShu0925/oc-ime-proof/tree/main/pr-195983.
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Proof on a real Gateway (secretless Docker, node 24.22.1, built Control UI, Chromium driven by Playwright with real IME composition through CDP
Changes on top of the contributor's fix: shorter comments and the composing check folded into the Escape condition (production +3/-5). I removed the new unit test file and its test-lines allocation and added one IME step to the existing section-editor e2e test, which fails on main (the editor closes on the composing Enter) and passes on this head. Test lines net -4. Screenshots: main right after the composing Enter (editor gone, |
|
Landed in 3f805fa. Thanks @SunnyShu0925. Enter during IME composition no longer saves the session-group dialog. |
…composition (openclaw#195983) fix(ui): guard personal session group search Enter submit during IME composition In the Control UI personal session-group dialog, the Search sessions box returned early while an IME was composing, before it blocked Enter. Pressing Enter to confirm an IME word submitted the form: the half-built section was saved, the editor closed and the search text was lost. The search box now blocks Enter in every state and leaves Escape to the IME while it is composing, using the existing isComposingKeyboardEvent. Evidence: a built Control UI with a real Gateway in secretless Docker on node 24.22.1, driven in Chromium with real IME composition over CDP, two runs on main and two on this head. On main, Enter while composing "Relea|se" saved a "Focus" section with only Roadmap review and closed the editor. With this change the dialog stays open, nothing is saved, and the list filters to "Release checklist" when the word commits. Plain Enter, the Save button and Escape outside composition behave the same on both. Control UI gzip: +0 B. Details: openclaw#195983 (comment). Before (main): Enter during composition saved the section and closed the editor.  After: the dialog stays open and filters by the committed word.  Thanks @SunnyShu0925. 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]>


What Problem This Solves
In the personal section editor's Search sessions box, pressing Enter while an IME composition was pending submitted the enclosing
<form>: the dialog closed mid-composition and the typed query was lost instead of filtering the list.The search input's keydown handler returned early on
event.isComposingbefore the Enter →preventDefault()guard ran, so a committing Enter reached<form onSubmit>→props.options.submit({ label, sessionKeys })inui/src/components/personal-session-group-dialog-view.tsx.The fix reuses the repository's shared guard,
isComposingKeyboardEvent(ui/src/lib/ime.ts), which a dozen sibling components already own:preventDefault()unconditionally, so a committing Enter never submits; the input method receives the key.Review follow-ups folded in: unused composition-tracking hooks (
recordCompositionEnd/clearCompositionEnd) removed, and the Escape test now settles the query so it exercises the real two-step contract.User Impact
CJK and other IME users can pick a candidate or confirm a search term with Enter without the section editor collapsing under them, and without losing their query. Escape during composition is left to the input method; after composition ends the first Escape clears search and the second closes it.
No change outside the IME path: search Enter still never submits, settled Escape still clears-then-closes, and the form's save-on-submit contract is untouched.
Why This Change Was Made
<form>whoseonSubmitcalls the save path. The oldif (event.isComposing) return;skipped the protectivepreventDefault(), so the invariant "Enter only filters" did not hold on the IME path.isComposingKeyboardEventis the existing owner for this guard (also coverskeyCode === 229and a WebKit composition-end grace window); no new helper, no new state.preventDefault()without reading them, and the only helper call was Escape, which ignores timestamps.inputandEscapesynchronously, observed the stale empty query, and never covered clear-then-close.Evidence
Browser proof on a real Chromium (Chrome 138), through the repo's own Control UI e2e server with a mocked Gateway. Composition comes from CDP
Input.imeSetComposition(f→fa→fabu→发布), so the browser itself emitscompositionstart,compositionupdate,beforeinput/inputwithisComposing: true, then the committing Enter.518e8a7ce802c7dkeydown EnterisComposing=true,keyCode=13,defaultPrevented=falseisComposing=true,keyCode=13,defaultPrevented=truesubmiteventssessions.groups.*requests发布committedsessions.list(search=发布)defaultPrevented=false, search open, query cleared by the IMERecordings: head 17s · base 14s — traces: head · base — driver, artifacts.
Regression test (
ui/src/components/personal-session-group-dialog.test.ts, 2 cases) is red on base (expected false to be truefordefaultPrevented) and green on head; siblingsession-group-defaults-dialog.test.tsstill passes. All 84 PR checks are green once802c7d.Gaps
compositionstart/compositionupdate/inputevents from Chrome's composition pipeline.isComposing: trueand emits nocompositionend, so the WebKit composition-end grace branch of the shared helper is not exercised here.Maintainer proof (built Control UI, real Gateway, real IME composition)
Details: #195983 (comment)
Before (main): Enter during composition saved the section and closed the editor.
After: the dialog stays open and filters by the committed word.