Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 123181e857674d4f0018e406b7ad0b4adfd99e2d and b32d9af. 📒 Files selected for processing (13)
🚧 Files skipped from review as they are similar to previous changes (13)
📝 WalkthroughWalkthroughThe IME keyboard event helper now accepts native and React keyboard events. Editor rename inputs, untitled-file rename fields, host and project-group rename dialogs, and worktree metadata inputs ignore composition key events. Shared dialog Escape handling also prevents closing during composition. New Vitest suites cover composing events, keyCode 229, normal Enter and Escape behavior, blur submission, modifier handling, and form submission. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
0163a96 to
dc873f2
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/renderer/src/components/editor/UntitledFileRenameDialog.tsx (1)
160-168: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate
onKeyDownblocks — extract a shared handler.The Name and Folder inputs now have byte-identical inline
onKeyDownclosures. Consider factoring this into oneuseCallback-memoized handler (similar tohandleIssueKeyDowninWorktreeMetaDialog.tsx) and reusing it for both fields.♻️ Proposed refactor
+ const handleFieldKeyDown = useCallback( + (e: React.KeyboardEvent<HTMLInputElement>) => { + if (isImeCompositionKeyDown(e)) { + return + } + if (e.key === 'Enter') { + e.preventDefault() + handleSubmit() + } + }, + [handleSubmit] + ) + return ( ... <Input ref={setNameInputNode} value={name} onChange={(e) => { setName(e.target.value) setError(null) }} - onKeyDown={(e) => { - if (isImeCompositionKeyDown(e)) { - return - } - if (e.key === 'Enter') { - e.preventDefault() - handleSubmit() - } - }} + onKeyDown={handleFieldKeyDown} ... /> ... <Input value={dir} onChange={(e) => { setDir(e.target.value) setError(null) }} - onKeyDown={(e) => { - if (isImeCompositionKeyDown(e)) { - return - } - if (e.key === 'Enter') { - e.preventDefault() - handleSubmit() - } - }} + onKeyDown={handleFieldKeyDown} className="h-8 text-xs" />Also applies to: 192-200
src/renderer/src/components/sidebar/WorktreeMetaDialog.ime-enter.test.tsx (1)
71-92: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract shared IME keyboard-event test helpers.
All five new
*.ime-enter.test.tsxfiles reimplement the sameKeyboardEventbuilder (withisComposing/legacykeyCode: 229overrides) and, in three of them, an identicalchangeValuecontrolled-input setter. One shared module would avoid five copies drifting apart as IME edge cases are added. Per the path guideline against vague file names, name it after its concrete purpose rather thantest-utils.
src/renderer/src/components/sidebar/WorktreeMetaDialog.ime-enter.test.tsx#L71-L92: import sharedpressEnter/changeValue(acceptingHTMLElementto cover both inputs and the textarea) instead of the local copies.src/renderer/src/components/editor/EditorPanelHeaderPath.ime-enter.test.tsx#L81-L98: replace localpressKeywith the shared helper (parameterized bykey).src/renderer/src/components/editor/UntitledFileRenameDialog.ime-enter.test.tsx#L50-L74: replace localpressEnter/changeValuewith the shared helpers.src/renderer/src/components/sidebar/HostRenameDialog.ime-enter.test.tsx#L50-L66: replace localpressEnterwith the shared helper.src/renderer/src/components/sidebar/ProjectGroupNameDialog.ime-enter.test.tsx#L48-L73: replace localpressEnter/changeValuewith the shared helpers (keep the return-value variant used here fordefaultPreventedassertions).♻️ Proposed shared module
// src/renderer/src/lib/ime-composition-keyboard-event.test-helpers.ts export function dispatchKeyDown( element: HTMLElement, key: string, init?: KeyboardEventInit & { keyCode?: number } ): KeyboardEvent { const event = new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true, ...init }) if (init?.keyCode !== undefined) { Object.defineProperty(event, 'keyCode', { value: init.keyCode }) } element.dispatchEvent(event) return event } export function setControlledInputValue(input: HTMLInputElement, value: string): void { const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set setter?.call(input, value) input.dispatchEvent(new Event('input', { bubbles: true })) }Source: Path instructions
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5cc8d733-4818-42f4-9270-8a4f4255dd61
📥 Commits
Reviewing files that changed from the base of the PR and between badf911 and dc873f218635e55f386978630bdf63fe74913597.
📒 Files selected for processing (13)
src/renderer/src/components/editor/EditorPanelHeaderPath.ime-enter.test.tsxsrc/renderer/src/components/editor/EditorPanelHeaderPath.tsxsrc/renderer/src/components/editor/UntitledFileRenameDialog.ime-enter.test.tsxsrc/renderer/src/components/editor/UntitledFileRenameDialog.tsxsrc/renderer/src/components/sidebar/HostRenameDialog.ime-enter.test.tsxsrc/renderer/src/components/sidebar/HostRenameDialog.tsxsrc/renderer/src/components/sidebar/ProjectGroupNameDialog.ime-enter.test.tsxsrc/renderer/src/components/sidebar/ProjectGroupNameDialog.tsxsrc/renderer/src/components/sidebar/WorktreeMetaDialog.ime-enter.test.tsxsrc/renderer/src/components/sidebar/WorktreeMetaDialog.tsxsrc/renderer/src/components/ui/dialog.tsxsrc/renderer/src/lib/ime-composition-keyboard-event.test.tssrc/renderer/src/lib/ime-composition-keyboard-event.ts
dc873f2 to
123181e
Compare
A CJK IME fires a keydown for the Enter that only confirms a conversion candidate. Five inputs committed on that keydown, saving a half-converted value while the user was still typing: - Project group name dialog (create/rename) — submitted the form implicitly - Host rename dialog - Worktree details dialog — display name, GH issue/PR, and the notes textarea, which saves on a plain Enter - Untitled file rename dialog — file name and folder - Editor header inline file rename They now use the existing isImeCompositionKeyDown() helper, matching the guards already in place for worktree titles, tabs, and the workspace name field.
123181e to
b32d9af
Compare
|
Landed, and then some — closing. The predicate this PR introduced ( Both surfaces you targeted are covered: Thanks — the framing that Enter-during-composition is an ownership question rather than a per-dialog bug is what made it generalize this far. |
Restore IME Enter protection in workspace details by reusing the existing composition tracker. Reset Notes ownership at textarea detachment and preserve sizing behavior. Repair isolated native test-window delivery without changing the production foreground policy or original native input assertions. Fixes #24097 Related contributor history: #10711, #11067, #13128, #13282. Original implementation and macOS recordings: @setodeve, commit b30f095. Verified on required stock Linux X11/Wayland checks and independent frozen-source review. Co-authored-by: setodeve <keinick11@outlook.com>
Description
Supersedes #10711 while preserving the original contributor commit and attribution. Prevents the Enter key used by CJK IMEs to confirm a conversion candidate from submitting project-group, host, file, worktree-name, issue, and notes inputs.
ELI5
When an IME turns typed phonetic text into a character, it first uses Enter to choose the character. Orca now waits for the next normal Enter before saving the form.
Fix proof
isComposing, legacykeyCode === 229, and ordinary Enter in each affected surface.pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/editor/EditorPanelHeaderPath.ime-enter.test.tsx src/renderer/src/components/editor/UntitledFileRenameDialog.ime-enter.test.tsx src/renderer/src/components/sidebar/HostRenameDialog.ime-enter.test.tsx src/renderer/src/components/sidebar/ProjectGroupNameDialog.ime-enter.test.tsx src/renderer/src/components/sidebar/WorktreeMetaDialog.ime-enter.test.tsx— 18 tests passed locally.No-regression proof / trade-offs
Plain Enter remains covered and submits normally. The existing Cmd/Ctrl-aware screen-submit shortcut remains after the shared IME guard; native CJK IME behavior still needs manual desktop verification on macOS, Linux, and Windows.
Review
One independent native review loop: clean. It confirmed the guard precedes each explicit submit, the project-group form prevents implicit submit during composition, and no shortcut ordering conflict was found; reviewer target run reported 21/21 passing.
Performance and compatibility
The guard is a constant-time keydown predicate with no polling, I/O, or allocation-heavy path. It uses browser keyboard event state only; there are no SSH, folder-workspace, Git provider, or path behavior changes.
Evidence
No Electron screenshot was captured: the behavior is native IME interaction and the automated component tests are the available deterministic proof.
Links
Supersedes and credits #10711 (@makoto-developer). Related category issue: #10711.
0 regressions / risk: UNKNOWN — targeted automated regressions are green, but native IME confirmation remains to be exercised on all desktop platforms.