Scenario

insertFromComposition targetRanges should be trusted even when collapsed in Desktop Safari

insertFromComposition targetRanges should be trusted even when collapsed in Desktop Safari

Scenario ID
scenario-ime-insertfromcomposition-targetranges

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-0214-ime-insertfromcomposition-targetranges-desktop-safari-korean macOS 14.0+ Desktop or Laptop Any Safari 17.0+ Korean (IME) draft
ce-0215-ime-insertfromcomposition-targetranges-ios-safari-japanese iOS 17.0+ iPhone or iPad Any Safari 17.0+ Japanese (IME) draft
ce-0216-ime-insertfromcomposition-missing-ios-safari-korean iOS 17.0+ iPhone or iPad Any Safari 17.0+ Korean (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: composition, ime, beforeinput, targetRanges

getTargetRanges() returns empty array in beforeinput events

The getTargetRanges() method in beforeinput events may return an empty array or undefined in various scenarios, including text prediction, certain IME compositions, or specific browser/device combinations. When getTargetRanges() is unavailable, developers must rely on window.getSelection() as a fallback, but this may be less accurate.

1 case
Tags: composition, ime, beforeinput, safari

insertParagraph preventDefault breaks IME composition state in Safari

In Safari desktop, when preventDefault() is called on keydown or beforeinput events for insertParagraph (Enter key), the IME composition state becomes corrupted. Subsequent text input fails to trigger proper input events, causing characters to not be inserted or composition to malfunction.

3 cases
Tags: composition, ime, beforeinput

beforeinput and input events have different inputType values

During IME composition or in certain browser/IME combinations, the beforeinput event may have a different inputType than the corresponding input event. For example, beforeinput may fire with insertCompositionText while input fires with deleteContentBackward. This mismatch can cause handlers to misinterpret the actual DOM change and requires storing beforeinput's targetRanges for use in input event handling.

1 case
Tags: composition, ime, beforeinput

Selection mismatch between beforeinput and input events

The selection (window.getSelection()) in beforeinput events can differ from the selection in corresponding input events. This mismatch can occur during IME composition, text prediction, or when typing adjacent to formatted elements like links. The selection in beforeinput may include adjacent formatted text, while input selection reflects the final cursor position.

1 case
Tags: composition, ime, korean

IME Composition State Management System

Comprehensive system for managing IME (Input Method Editor) composition state across different browsers and IME implementations, including state tracking, event normalization, and cross-platform consistency.

0 cases

Comments & Discussion

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