Case ce-0217-keyboard-handlers-iscomposing-false-ios-safari-korean · Scenario scenario-ime-interaction-patterns

isComposing is always false in iOS Safari Korean IME, breaking keyboard handler composition detection

OS: iOS 17.0+ Device: iPhone or iPad Any Browser: Safari 17.0+ Keyboard: Korean (IME) Status: draft
composition ime beforeinput input isComposing keyboard ios safari korean

Phenomenon

In iOS Safari with Korean IME, the isComposing flag is always false in beforeinput and input events, and composition events (compositionstart, compositionupdate, compositionend) do not fire. This breaks the standard pattern of detecting composition state to allow browser default behavior for keyboard handlers (Enter, Backspace, Delete). Editors that override keyboard handlers must always allow browser default behavior in iOS Safari.

Reproduction example

  1. Create a contenteditable element with custom keyboard handlers for Enter, Backspace, Delete.
  2. Focus the element in iOS Safari (iPhone/iPad).
  3. Activate Korean IME.
  4. Start composing Korean text (e.g., type “ㅎ” then “ㅏ” then “ㄴ” to compose “한”).
  5. While composition is active, press Enter, Backspace, or Delete.
  6. Observe that isComposing is false in beforeinput events.
  7. Observe that composition events do not fire.
  8. Custom keyboard handlers think composition is not active and prevent default.
  9. This breaks composition behavior.

Observed behavior

When pressing Enter/Backspace/Delete during Korean composition:

  1. isComposing is always false:

    • beforeinput events have isComposing: false
    • input events have isComposing: false
    • Cannot detect composition state using isComposing flag
  2. Composition events do not fire:

    • compositionstart does NOT fire
    • compositionupdate does NOT fire
    • compositionend does NOT fire
    • Cannot detect composition state using composition events
  3. Custom keyboard handlers break composition:

    • Handlers check isComposing → always false
    • Handlers think composition is not active
    • Handlers prevent default and handle keys customly
    • This interferes with browser’s composition handling
    • Composition text may be lost or incorrectly handled
  4. Result:

    • Enter during composition may break composition or insert line break incorrectly
    • Backspace during composition may delete incorrectly
    • Delete during composition may delete incorrectly
    • Composition behavior is broken

Expected behavior

  • isComposing flag should accurately reflect composition state
  • Composition events should fire during composition
  • Custom keyboard handlers should be able to detect composition state
  • Browser default behavior should be allowed during composition
  • Keyboard handlers should not interfere with composition

Impact

  • Broken composition: Custom keyboard handlers interfere with IME composition
  • Lost text: Composition text may be lost or incorrectly handled
  • Incorrect behavior: Enter/Backspace/Delete may not work as expected during composition
  • Platform-specific bugs: Code that works on other browsers fails on iOS Safari
  • IME-specific bugs: Code that works with other IMEs fails with Korean IME on iOS Safari
  • Editor compatibility: Editors that rely on isComposing or composition events break on iOS Safari

Browser Comparison

  • iOS Safari (Korean IME): isComposing is always false, composition events do NOT fire
  • iOS Safari (Japanese/Kanji IME): isComposing is accurate, composition events fire
  • Desktop Safari: isComposing is accurate, composition events fire
  • Chrome/Edge: isComposing is accurate, composition events fire
  • Firefox: isComposing is accurate, composition events fire

Notes and possible direction for workarounds

  • Always allow browser default in iOS Safari: Do not prevent default for keyboard handlers in iOS Safari:

    const isIOSSafari = /iPhone|iPad|iPod/.test(navigator.userAgent) && 
                        /Safari/.test(navigator.userAgent) && 
                        !/Chrome/.test(navigator.userAgent);
    
    element.addEventListener('beforeinput', (e) => {
      // iOS Safari: Always allow browser default for keyboard handlers
      if (isIOSSafari) {
        if (e.inputType === 'insertParagraph' || 
            e.inputType === 'deleteContentBackward' ||
            e.inputType === 'deleteContentForward') {
          return; // Allow browser default
        }
      }
      
      // Standard browsers: Check isComposing
      if (e.isComposing) {
        return; // Let browser handle it
      }
      
      // Custom keyboard handling
      if (e.inputType === 'insertParagraph') {
        e.preventDefault();
        handleCustomEnter();
      }
    });
  • Detect iOS Safari Korean IME pattern: Recognize deleteContentBackward + insertText pattern:

    let lastDeleteBackward = null;
    const isIOSSafari = /iPhone|iPad|iPod/.test(navigator.userAgent) && 
                        /Safari/.test(navigator.userAgent) && 
                        !/Chrome/.test(navigator.userAgent);
    
    element.addEventListener('beforeinput', (e) => {
      if (isIOSSafari) {
        // iOS Safari Korean IME pattern
        if (e.inputType === 'deleteContentBackward') {
          lastDeleteBackward = e;
          return; // Allow browser default
        }
        
        if (e.inputType === 'insertText' && lastDeleteBackward) {
          lastDeleteBackward = null;
          return; // Allow browser default (composition update)
        }
        
        // Conservative: allow browser default for all keyboard handlers
        if (e.inputType === 'insertParagraph' || 
            e.inputType === 'deleteContentBackward' ||
            e.inputType === 'deleteContentForward') {
          return; // Allow browser default
        }
      }
      
      // Standard browsers
      if (e.isComposing) {
        return;
      }
      
      // Custom handling
      // ...
    });
  • Do not rely on isComposing in iOS Safari: For iOS Safari Korean IME, do not use isComposing flag to detect composition

  • Do not rely on composition events in iOS Safari: For iOS Safari Korean IME, do not use composition events to detect composition

  • Use platform detection: Detect iOS Safari and apply special handling

  • Use beforeinput instead of keydown: beforeinput events provide better composition state information than keydown events

Before

Hello

Korean composition in progress
User presses Enter (Bug)

Hello

Custom Enter handler prevents default, breaks composition
vs
✅ Expected

Hello

Browser default behavior handles Enter during composition correctly

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-0002-ime-enter-breaks Windows 11 Desktop or Laptop Any Chrome 120.0 Korean (IME) draft
ce-0004-ime-backspace-removes-whole-syllable Windows 11 Desktop or Laptop Any Chrome 120.0 Korean (IME) draft
ce-0022-ime-enter-breaks-firefox Windows 11 Desktop or Laptop Any Firefox 120.0 Korean IME draft
ce-0030-backspace-composition-chrome macOS Ubuntu 22.04 Desktop or Laptop Any Chrome 120.0 Japanese IME draft
ce-0035-backspace-deletes-whole-word macOS Ubuntu 22.04 Desktop or Laptop Any Safari 120.0 US draft
ce-0042-input-events-duplicate Windows 11 Desktop or Laptop Any Edge 120.0 US draft
ce-0058-contenteditable-with-autocomplete macOS Ubuntu 22.04 Desktop or Laptop Any Chrome 120.0 US draft
ce-0070-contenteditable-with-autocapitalize iOS 17.0 iPhone Any Safari 17.0 US draft
ce-0071-contenteditable-with-autocorrect iOS 17.0 iPhone Any Safari 17.0 US draft
ce-0181-japanese-ime-enter-breaks-chrome Windows 11 Desktop or Laptop Any Chrome 120.0 Japanese (IME) draft
ce-0182-chinese-ime-enter-breaks-safari macOS 14.0 Desktop or Laptop Any Safari 17.0 Chinese (IME - Pinyin) draft
ce-0185-japanese-ime-backspace-granularity-chrome Windows 11 Desktop or Laptop Any Chrome 120.0 Japanese (IME) draft
ce-0186-chinese-ime-backspace-granularity-safari macOS 14.0 Desktop or Laptop Any Safari 17.0 Chinese (IME - Pinyin) draft
ce-0195-thai-ime-enter-breaks-chrome Windows 11 Desktop or Laptop Any Chrome 120.0 Thai (IME) draft
ce-0196-vietnamese-ime-enter-breaks-edge Windows 11 Desktop or Laptop Any Edge 120.0 Vietnamese (IME) draft
ce-0199-thai-ime-backspace-granularity-chrome Windows 11 Desktop or Laptop Any Chrome 120.0 Thai (IME) draft
ce-0200-vietnamese-ime-backspace-granularity-edge Windows 11 Desktop or Laptop Any Edge 120.0 Vietnamese (IME) draft
ce-0217-keyboard-handlers-iscomposing-false-ios-safari-korean iOS 17.0+ iPhone or iPad Any Safari 17.0+ Korean (IME) draft
ce-0565-chrome-121-oninput-offset-0 Windows 11 Desktop Any Chrome 121.0.6167.86 US QWERTY confirmed
ce-0579 macOS 15.0 (Sequoia) Desktop Any All Browsers (ProseMirror context) Latest (Nov 2025) Apple Magic Keyboard (US) confirmed
ce-0581 Android 14.0 / 15.0 Smartphone Any Chrome 131.0+ Gboard (Emoji) 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: iOS 17.0+
Device: iPhone or iPad Any
Browser: Safari 17.0+
Keyboard: Korean (IME)
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.