Skip to content

chore(lint): flag Enter handling on raw text fields that skips the IME guard - #28609

Merged
nwparker merged 1 commit into
mainfrom
nwparker/ime-enter-lint
Oct 14, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/ime-enter-lint

Conversation

@nwparker

@nwparker nwparker commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​138 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​138
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​220 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​218

ELI5

When you type Japanese, Chinese or Korean, you press Enter to confirm a word, not to submit. Some text boxes treated that Enter as "submit" and sent half-typed text. Orca already has a guard against this, but nothing stopped new code from skipping it. This adds a lint check that catches the mistake before it ships, and fixes the one place that had quietly lost its guard.

What Changed

Before: keeping Enter IME-safe depended on each author remembering the guard. Earlier misses became #17820 and #25531. One handler, automation run history, still had a check that could never fire.

After:

  • ime-enter-guard/require-ime-guard (in config/oxlint-plugins/ime-enter-guard.mjs) fails lint when Enter handling on a raw text field doesn't go through the IME guard. It checks onKeyDown/onKeyPress handlers that test for Enter on raw <input> (text-like types), <textarea>, or contentEditable elements, and keydown listeners on text-field refs.
  • A handler passes if it uses isImeOwnedKeyboardEvent, isImeCompositionKeyDown, useImeTextFieldProps, an isComposing check, or keyCode 229.
  • <Input>, <Textarea>, ImeInput and ImeTextarea are never flagged, because they already wrap the guard.

Fix: automation run-history keyboard navigation checked event.nativeEvent?.isComposing. It runs from a window listener, which receives native events that have no nativeEvent wrapper, so Enter during composition was never ignored. It now uses the shared isImeOwnedKeyboardEvent.

Why

A lint rule enforces the guard everywhere, including in code that doesn't exist yet. The alternative, auditing by hand after each bug report, is what has let this class keep coming back. To keep false positives low, the rule skips:

  • buttons and list rows;
  • non-text inputs;
  • handlers whose body it can't see;
  • elements that handle composition themselves;
  • window/document listeners, which already ignore events coming from text fields.

Linked Issue

None. This is a follow-up to #17820 and #25531, both of which are closed.

Visual Proof

N/A. This is a lint rule plus a keyboard-handling fix with no visual change.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • config/scripts/ime-enter-guard-plugin.test.mjs: 9 cases that must be flagged and 12 that must not. All pass.

  • automation-run-history-keyboard-navigation.test.ts: new cases check that Enter during composition (and keyCode 229) is ignored, and that Enter after the commit is handled.

  • Running the rule over all of src/renderer/src gives 0 findings. A deliberate violation is flagged with the expected message.

  • pnpm tc:web is clean and check:code-quality:changed passes.

Review

The rule's heuristics are in one file. The thing to check is false positives: if it flags something it shouldn't, the skip list in the plugin is the place to change.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Scope: renderer only. Test, spec and benchmark files are excluded from the rule.
  • Platforms: no runtime change on any platform except the run-history guard.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 1 minute.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 080d7c9d-bfbe-489e-bb8a-a72051d31bae
📥 Commits

Reviewing files that changed from the base of the PR and between f2df6a7 and 593737d.

📒 Files selected for processing: 5
  • .oxlintrc.json
  • config/oxlint-plugins/ime-enter-guard.mjs
  • config/scripts/ime-enter-guard-plugin.test.mjs
  • src/renderer/src/components/automations/automation-run-history-keyboard-navigation.test.ts
  • src/renderer/src/components/automations/automation-run-history-keyboard-navigation.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…E guard

Adds an oxlint plugin rule that reports Enter-key handlers on raw input,
textarea, and contentEditable elements (and keydown listeners on text-field
receivers) unless the handler reaches the shared IME guard. Also routes the
automation run history window listener through isImeOwnedKeyboardEvent, whose
previous nativeEvent check never fired for native events.
@nwparker
nwparker force-pushed the nwparker/ime-enter-lint branch from 0b9e38c to 593737d Compare October 14, 2026 07:08
@nwparker
nwparker merged commit ae88423 into main Oct 14, 2026
33 checks passed
nwparker added a commit that referenced this pull request Oct 27, 2026
…rward dialog (#34315)

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.

Co-authored-by: Seiji Kohara <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant