Skip to content

Connection capsule disappears when confirming IME text on iOS Safari #92

Description

@tktm8

Bug

When composing Japanese text in the chat composer on iOS Safari, confirming an IME conversion can remove an attached Connection capsule from the input.

This is related to, but distinct from, #81: that issue covers Enter incorrectly sending during IME composition, while this issue covers loss of a structured connection token.

Steps to reproduce

  1. Open Cloudflare OS in iOS Safari.
  2. Add a Connection capsule to the chat composer.
  3. Type Japanese text using the system IME.
  4. Confirm a conversion.

Actual behavior

The Connection capsule can disappear from the composer.

Expected behavior

Confirming IME text should commit only the composed text. Existing Connection capsules must remain attached.

Root cause

Mobile Safari emits controlled-textarea changes while composition is still in progress and can report a stale selection range. The composer currently runs token overlap bookkeeping for every provisional value. A provisional edit can therefore be misclassified as crossing the capsule range, causing the capsule to be removed.

Proposed fix

Track composition explicitly. Continue rendering provisional text, but defer capsule and token bookkeeping until compositionend, then apply the committed edit once against the value captured at compositionstart. Also avoid handling Enter as a composer command while composition is active.

Validation

  • Frontend TypeScript build
  • Production Vite build
  • Manual reproduction on iOS Safari with a Connection capsule and Japanese IME

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions