Scenario

keyCode 229 and Enter during IME composition

During IME composition, keydown often reports keyCode 229 (VK_PROCESSKEY on Windows) for many keys, meaning the event is part of an input method sequence. Enter may commit composition, insert a newline, or be swallowed—Chrome vs Firefox vs Japanese layouts differ. Handlers that assume Enter always means insertParagraph break composition incorrectly.

ime
Scenario ID
scenario-ime-composition-keydown-keycode-229

Details

During IME composition, keydown often reports keyCode 229 (VK_PROCESSKEY on Windows) for many keys, meaning the event is part of an input method sequence. Enter may commit composition, insert a newline, or be swallowed—Chrome vs Firefox vs Japanese layouts differ. Handlers that assume Enter always means insertParagraph break composition incorrectly.

Problem Overview

Legacy keyCode / which APIs are deprecated but still used in hot paths. 229 is a sentinel: “handled by IME; don’t treat as a normal key.” Ignoring that and running custom Enter logic during isComposing causes double commits or cancelled composition.

Observed Behavior

  • Enter fires with keyCode 229 during composition; beforeinput may carry insertLineBreak or composition commit depending on engine.
  • Japanese IME: Enter to select first candidate vs newline differs by IME settings.

Impact

Duplicate lines, lost syllables, or editors that block Enter entirely during IME.

Browser Comparison

Chrome and Firefox dispatch different sequences around Enter + composition; macOS vs Windows keyboard stacks add variance.

Solutions

  • Prefer e.isComposing and beforeinput inputType over raw keyCode for control flow.
  • If you must use keydown, treat 229 as “possibly IME—do not insert structural nodes.”
  • Test Japanese and Korean Enter behavior explicitly.

References

Scenario flow

Visual view of how this scenario connects to its concrete cases and environments. Nodes can be dragged and clicked.

React Flow mini map

Variants

Each row is a concrete case for this scenario, with a dedicated document and playground.

Case OS Device Browser Keyboard Status
ce-0210-ime-keydown-keycode-229-enter-chrome Windows 11 Desktop or Laptop Any Chrome 120.0 Korean (IME) draft
ce-0211-ime-keydown-keycode-229-enter-firefox Windows 11 Desktop or Laptop Any Firefox 120.0 Korean (IME) draft
ce-0212-ime-keydown-keycode-229-enter-japanese-chrome Windows 11 Desktop or Laptop Any Chrome 120.0 Japanese (IME) draft

Browser compatibility

This matrix shows which browser and OS combinations have documented cases for this scenario. Click on a cell to view the specific case.

Confirmed
Draft
No case documented

Cases

This scenario affects multiple languages. Cases are grouped by language/input method below.

Japanese

1 case

Korean

2 cases

Related Scenarios

Other scenarios that share similar tags or category.

Tags: ime, composition, chrome, firefox

IME composition when focus moves between elements (Korean and others)

If the user switches focus to another field, button, or nested contenteditable while Korean (or other) IME composition is active, browsers differ on whether composition is committed, cancelled, or leaves orphan state. Chrome, Safari, and Firefox do not agree; mobile adds more variance.

3 cases
Tags: ime, composition, chrome, firefox

Paste during IME composition cancels or corrupts composition

Pasting from the clipboard while IME composition is active may cancel the composition session, replace the wrong range, or interleave pasted text with unfinished syllables—Firefox and Chrome show different behavior for Korean and Hindi IME paths.

2 cases
Tags: ime, composition, firefox

Escape key during IME composition

Escape typically cancels IME composition or closes the candidate window. In Edge, Firefox, and other engines, timing and whether partial text remains in the DOM differ—Arabic and Korean IME cases show cross-browser variance.

2 cases
Tags: ime, composition, chrome

Blur and focus during IME composition (CJK and Japanese Safari)

Moving focus away from the editor while composing text (Chinese, Japanese, Korean) can cancel composition, commit partial text, or leave the IME candidate window out of sync. Safari often shows distinct behavior for Japanese; Chrome behavior for Chinese/Korean is covered in related cases.

2 cases
Tags: ime, composition, firefox

Tab key during IME composition (focus vs indent vs IME)

Tab moves focus by default. During IME composition, Tab may cancel composition, cycle candidates, or be captured by the editor for indentation—behavior differs for Chinese, Thai, and Safari vs Firefox.

2 cases

Comments & Discussion

Have questions, suggestions, or want to share your experience? Join the discussion below.