Avoid synthetic-input bugs in automation targeting IME-based (CJK) text entry by respecting composition events instead of raw keydown

domain: developer.mozilla.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Recognize that typing CJK text involves a distinct composition phase — compositionstart/compositionupdate/compositionend fire around the eventual final input event, not a simple keydown/keyup per character
  2. When scripting Enter-key handling for an app under test, check the event's isComposing flag before treating Enter as a submit/select action, since an IME Enter often confirms a candidate rather than submitting
  3. In frameworks with synthetic event systems (e.g. React), read isComposing off the native event rather than the synthetic wrapper, since the synthetic event may not carry it
  4. When driving automation input synthetically, prefer setting the input value plus dispatching input/composition events over simulating raw per-character key presses, since most automation keyboard APIs type Latin characters without a real IME composition sequence
  5. Test with an actual non-Latin locale/keyboard layout in CI rather than assuming Latin-keyboard automation coverage generalizes, since physical key codes are layout-dependent

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans