Re: [w3c/editing] All browsers: Impossible to cancel inputs when they are starting character composition (IME) (Issue #508)

michael left a comment (w3c/editing#508)

Found a solution how you can actually cancel IMEs.

```js
  function oncompositionstart(event) {
    // eg. when multiple nodes are selected, or inside a cursor trap
    if (doc.selection.type !== 'text') {
      const dom_selection = window.getSelection();
      dom_selection.removeAllRanges();
    } else {
      // handle the IME, when you have text cursor/selection.
    }
  }
```

While this workaround works, I still wonder if there would be any negative consequences if browsers allowed cancelling composition events at the very beginning (not in the middle of it).

It would be a cleaner API in my opinion, but maybe I'm overlooking something?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/508#issuecomment-3542010892
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/editing/issues/508/3542010892@github.com>

Received on Monday, 17 November 2025 14:08:05 UTC