Repository navigation
fix(ssh): keep the IME confirmation Enter from submitting the port-forward dialog - #34126
seijikohara wants to merge 1 commit into
Conversation
…rward dialog The SSH port-forward dialog renders its four fields as raw inputs inside a form with a submit button. IMEs that redispatch an unmarked Enter after compositionend therefore trigger implicit submission with the half-typed value. The pre-revert ImeEnterGuardedForm covered this form; #25480 moved the guard into shared fields but did not reach these raw inputs, and the #28609 lint rule only inspects Enter handlers, which these fields lack. Render the fields with ImeInput so the shared gesture tracker swallows the confirmation and its redispatch while ordinary Enter still submits.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
No actionable comments were generated in the recent review.
|
|
Thanks @seijikohara! Your fix landed with your authorship preserved in #34315 (we run CI only on in-repo branches, so we carried your commit over). Closing this one in favor of it. Fixes #34124. |
ELI5
When you type Japanese or Chinese, the first Enter only confirms the converted word.
In the SSH "Forward a Port" dialog, some input methods made that same Enter submit the form, so Orca requested the forward with a half-typed label or host. Now the confirming Enter only confirms, and the next Enter submits.
What Changed
Before:
<input type="text">elements inside a<form>with a submit button.Enter/13 aftercompositionend, nothing intercepts that keydown, and the browser submits the form implicitly.After:
ImeInput(src/renderer/src/lib/ime-text-field.tsx).Mechanism:
ImeInputappliesuseImeTextFieldProps, which uses the shareduseImeEnterGestureOwnershiptracker.preventDefault()on the carried unmarked redispatch, so the browser never runs implicit submission for it.INPUT_CLASSare unchanged, so the dialog renders identically.Why
Input,Textarea,ImeInput,ImeTextarea,CommandInput), but it did not convert this dialog's raw inputs. Before Revert the terminal IME composition-ownership change #13282 reverted it,ImeEnterGuardedFormcovered this form.ime-enter-guard/require-ime-guardrule from chore(lint): flag Enter handling on raw text fields that skips the IME guard #28609 checks Enter handlers. These fields have no handler, so the rule cannot see them.ImeInputrather thanInput:ImeInputis unstyled, so the fields keep their current look. Switching toInputwould also change their styling.ImeInputfollows the field-level pattern fix: prevent IME Enter from submitting text fields across Orca #25480 established. A form-level wrapper would bring back the component that pattern replaced.Linked Issue
Fixes #34124
Visual Proof
How the images were made
ORCA_BACKGROUND_LAUNCH=1, the repository's E2E harness, Playwright CDP).connected, so the Ports panel offers "Forward a Port".Input.imeSetComposition: かいはつ, then 開発Process/229 keydownInput.insertTextEnter/13 keydown withtext: "\r": the unmarked redispatch, in Windows/Linux orderAfter the fix, a deliberate Enter still submits:
Testing
Tested on macOS (Apple silicon) only. The change has no platform-specific code.
Manual: I ran the Visual Proof flow above in hidden launches of main @ b759a95 and of this branch.
New test:
ssh-port-forward-dialog.ime-enter.test.tsxcovers each of the four fields.Process/229) and the unmarked redispatch, and asserts that the redispatch keydown is default-prevented and nothing is submitted.Existing tests: the
right-sidebarPorts suites (PortsPanel.test.tsx,PortsPanel.folder-workspace.test.tsx,ssh-forwarded-ports-section.test.tsx,ports-panel-host.test.ts,local-workspace-port-sections.test.ts) andime-text-field.test.tsxpass. With the new test, that is 7 files and 110 tests.pnpm typecheckpasses.check:code-quality:changedandcheck:react-doctor:changedagainst main @ b759a95 report 0 new findings.pnpm lint: every step passes exceptcheck:flaky-test-pattern-ratchet, which cannot run as configured here.origin/main, and the diff output overflows (spawnSync git ENOBUFS).ORCA_FLAKY_TEST_RATCHET_ALL=1it checks every file instead. It then reports findings in foursrc/main/ipc/filesystem/watchers/*.test.tsfiles, and unmodified main @ b759a95 reports the same findings.test-*rules report no finding in this PR's two files.pnpm testfails locally in 83 of 13,503 test files. None of the failing files covers a module this PR changes:/varversus/private/vartemp paths, zsh prompt and PTY timeouts, and a self-signed certificate in the TLS chain.pnpm build:build:desktoppasses, including the mobile web bundle. Before that, I installed themobile/dependencies withpnpm install --frozen-lockfile, as theinstall-mobile-dependenciesaction does.build:nativefails to link the x86_64 slice ofnotification-status-macos: this machine's Command Line Tools ship the Swift compatibility libraries for arm64 only. Unmodified main @ b759a95 fails the same way, and this PR changes no native code.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Implemented with Claude Code (Claude Opus 5.5) under my direction.
Review
AI review with Claude Code (Claude Opus 5.5), in a separate pass over the diff. It found no blocking issue and checked these points:
ImeInputpasses every prop through and adds onlyonKeyDown,onKeyUp,onCompositionStart,onCompositionEndandonBlur. The dialog'sonChangehandlers are untouched.<form>, following their imports two levels deep, found no other raw text input inside a submitting form.Its two test suggestions are applied: the test no longer advances timers between the two Enters, and it asserts that the submitted request carries the confirmed value.
Compatibility and risk:
classNameis passed through.Agent skill upstream boundary
Notes
<form>that have no Enter handler, which is how this field escaped both fix: prevent IME Enter from submitting text fields across Orca #25480 and chore(lint): flag Enter handling on raw text fields that skips the IME guard #28609.Author
X handle: none.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)