Re: [w3c/uievents] Event order between "compositionend" and "input" (#202)

tats-u left a comment (w3c/uievents#202)

> How often are these events used?

If you consider to avoid the process when the input text is half-baked because of IME, you must use at least one of them.

And React's onChange is actually onInput.

An `onInput` where `isComposing = false` must be emitted to keep the implementation simple with keeping compatibility with IME.

https://codepen.io/tats-u/pen/VYZBEWM

```js
import {micromark} from "https://esm.sh/micromark";

document.addEventListener("DOMContentLoaded", () => {
  const textArea = document.querySelector("textarea");
  textArea.addEventListener("input", (event) => {
    if (event.isComposing) {
    return;
  }
    // Your relatively heavy process here:
    document.querySelector("pre").innerText = micromark(textArea.value);
  });
});
```

The current behavior of Chromium is terrible and unfriendly.

https://tats-u.github.io/kbdevents/

Chromium emits `onCompositionEnd` after `onInput`, and it seems to be the reason why the `isComposing` of `onInput` when the complete text is sent from IME is `true`.

I believe Firefox's order is ideal and natural and the specs must be revised.

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

Message ID: <w3c/uievents/issues/202/2780549829@github.com>

Received on Saturday, 5 April 2025 08:09:19 UTC