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

> Currently, DOM composition events do not support of committing a part of composition. In such case, Firefox commits existing composition first, then, restart composition with new range.

Oh, I see. The spec seems to suggest there should be no extra `compositionstart`:

> Note that while every composition only has one compositionstart event, it may have several compositionend events.

But I notice neither Chrome nor Firefox do that.

For my reference I am testing using this pen: https://codepen.io/birtles/pen/pZwNPx

Following the stems from Masayuki for MS-IME:

> 1. Open preferences dialog
> 2. Press key assign from "Microsoft IME" to "ATOK"
> 3. Type something which may cause 2 or more clauses.
> 4. Type Space bar to convert.
> 5. Type ArrowDown key.

I get in Firefox:

```
compositionstart (value: )
input (value: k, isComposing: true)
input (value: こ, isComposing: true)
input (value: こr, isComposing: true)
input (value: これ, isComposing: true)
input (value: これh, isComposing: true)
input (value: これは, isComposing: true)
input (value: これはt, isComposing: true)
input (value: これはて, isComposing: true)
input (value: これはてs, isComposing: true)
input (value: これはてす, isComposing: true)
input (value: これはてすt, isComposing: true)
input (value: これはてすと, isComposing: true)
input (value: これはテスト, isComposing: true)
compositionend (value: これは)
input (value: これは, isComposing: false)
compositionstart (value: これは)
input (value: これはテスト, isComposing: true)
compositionend (value: これはテスト)
input (value: これはテスト, isComposing: false)
```

In Chrome:

```
compositionstart (value: )
input (value: k, isComposing: true)
input (value: k, isComposing: true)
input (value: こ, isComposing: true)
input (value: こ, isComposing: true)
input (value: こr, isComposing: true)
input (value: こr, isComposing: true)
input (value: これ, isComposing: true)
input (value: これ, isComposing: true)
input (value: これ, isComposing: true)
input (value: これh, isComposing: true)
input (value: これh, isComposing: true)
input (value: これは, isComposing: true)
input (value: これは, isComposing: true)
input (value: これはt, isComposing: true)
input (value: これはて, isComposing: true)
input (value: これはて, isComposing: true)
input (value: これはてs, isComposing: true)
input (value: これはてs, isComposing: true)
input (value: これはてす, isComposing: true)
input (value: これはてす, isComposing: true)
input (value: これはてすt, isComposing: true)
input (value: これはてすt, isComposing: true)
input (value: これはてすと, isComposing: true)
input (value: これはてすと, isComposing: true)
input (value: これはテスト, isComposing: true)
input (value: これは, isComposing: true)
compositionend (value: これは)
compositionstart (value: これは)
input (value: これはテスト, isComposing: true)
input (value: これはテスト, isComposing: true)
compositionend (value: これはテスト)
```

Edge:

```
compositionstart (value: )
input (value: k, isComposing: undefined)
input (value: こ, isComposing: undefined)
input (value: こr, isComposing: undefined)
input (value: これ, isComposing: undefined)
input (value: これh, isComposing: undefined)
input (value: これは, isComposing: undefined)
input (value: これはt, isComposing: undefined)
input (value: これはて, isComposing: undefined)
input (value: これはてs, isComposing: undefined)
input (value: これはてす, isComposing: undefined)
input (value: これはてすt, isComposing: undefined)
input (value: これはてすと, isComposing: undefined)
input (value: これはテスト, isComposing: undefined)
compositionend (value: これはテスト)
```

If some Korean IMEs allow Enter to do double-duty as committing a composition and entering a newline then it sounds like distinguishing between the two actions is a separate matter as you say. If `beforeinput` lets authors recognize a genuine newline (I didn't quite understand this part but would love to know how this work) then that's even better.

So it sounds like the proposal to make the last input event before the compositionend event have `isComposing` be set to false could work.

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

Received on Friday, 3 August 2018 00:17:59 UTC