Case ce-0577-android-first-word-duplication · Scenario scenario-ime-composition-duplicate-events

Android: First word duplication after space + backspace

OS: Android 14.0 Device: Smartphone Any Browser: Chrome 131.0 Keyboard: Gboard (English/Korean) Status: confirmed
android ime duplication composition chrome-131

Phenomenon

One of the most elusive and frustrating behaviors on Android involves the “Ghost Buffer.” When users perform a sequence of typing, spacing, and backspacing at the start of a block or after a specific punctuation, the Android IME (Gboard, Samsung Keyboard) often fails to synchronize its last-committed word with the browser’s DOM. This results in the editor suddenly duplicating the last word or character when the user resumes typing.

Reproduction Steps

  1. Open a contenteditable editor on Android Chrome.
  2. Type a word (e.g., “Hello”).
  3. Type a space.
  4. Press Backspace to delete the space.
  5. Immediately type another letter or another space.
  6. Observe the duplication in the DOM.

Observed Behavior

  • input event explosion: The browser sends multiple insertText or insertCompositionText events in rapid succession.
  • Buffer Re-submission: The IME sends the entire internal buffer (e.g., “Hello”) again, even though it was already committed to the DOM.
  • Caret Displacement: The caret often jumps to the end of the duplicated string, forcing the user to manually delete the extra text.

Expected Behavior

The IME should maintain a strict 1:1 mapping with the DOM nodes. A backspace should correctly clear the internal buffer’s “last character” state without triggering a re-submission of the entire preceding word.

Impact

  • Severe Typing Resistance: Users have to constantly stop and fix duplicated text, making long-form writing nearly impossible.
  • State Corruption: If the editor uses a structured model, these “unauthorized” mutations can bypass the model’s logic, leading to a de-sync between the UI and the data.

Browser Comparison

  • Chrome for Android: High frequency of occurrence across various Android versions.
  • Firefox for Android: Generally more stable in buffer management but has its own “stutter” issues.
  • iOS Safari: Almost never exhibits this specific buffer re-submission bug.

References & Solutions

Mitigation: Composition Locking

Many frameworks (Lexical, ProseMirror) implement a “mutation guard” that detects if the DOM has changed in a way that the model didn’t authorize during a composition session, and if so, it forced-reconciles the DOM back to the model state.

/* Conceptual Mitigation */
element.addEventListener('input', (e) => {
  if (isAndroid && e.inputType === 'insertCompositionText') {
    // Detect if the incoming text dramatically differs from the expected diff
    if (isLikelyDuplication(e.data, currentModel)) {
      e.stopImmediatePropagation();
      forceReconcileModelToDom();
    }
  }
});
Step 1: Type First Word
Hello |
User types 'Hello' followed by a space.
Step 2: Backspace and Re-type
Hello|
User backspaces to delete the space and then tries to type again or delete more.
vs
✅ Expected
Hello|
Expected: No duplication should occur. The IME should correctly map its internal buffer to the current DOM state.

Browser compatibility matrix

This matrix shows which browser and OS combinations have documented cases for this scenario. The current case is highlighted. Click on a cell to view other cases.

Current case
Confirmed
Draft
No case documented

All variants (detailed table)

Complete list of all cases for this scenario with full environment details.

Case OS Device Browser Keyboard Status
ce-0096-ime-composition-duplicate-events-ios-safari iOS 17.0 iPhone or iPad Any Safari 17.0 Korean (IME) draft
ce-0577-android-first-word-duplication Android 14.0 Smartphone Any Chrome 131.0 Gboard (English/Korean) confirmed

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: Android 14.0
Device: Smartphone Any
Browser: Chrome 131.0
Keyboard: Gboard (English/Korean)
Your environment
Sample HTML:
Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.

Comments & Discussion

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