Repository navigation
chore(lint): flag Enter handling on raw text fields that skips the IME guard - #28609
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou'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. View limit details
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 |
…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
force-pushed
the
nwparker/ime-enter-lint
branch
from
October 14, 2026 07:08
0b9e38c to
593737d
Compare
9 tasks done
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]>
Closed
8 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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(inconfig/oxlint-plugins/ime-enter-guard.mjs) fails lint when Enter handling on a raw text field doesn't go through the IME guard. It checksonKeyDown/onKeyPresshandlers that test for Enter on raw<input>(text-like types),<textarea>, or contentEditable elements, andkeydownlisteners on text-field refs.isImeOwnedKeyboardEvent,isImeCompositionKeyDown,useImeTextFieldProps, anisComposingcheck, or keyCode 229.<Input>,<Textarea>,ImeInputandImeTextareaare 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 nonativeEventwrapper, so Enter during composition was never ignored. It now uses the sharedisImeOwnedKeyboardEvent.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:
window/documentlisteners, 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/srcgives 0 findings. A deliberate violation is flagged with the expected message.pnpm tc:webis clean andcheck:code-quality:changedpasses.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
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)