- From: Michael Aufreiter <notifications@github.com>
- Date: Tue, 18 Nov 2025 10:16:01 -0800
- To: w3c/editing <editing@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/editing/issues/511/3548969950@github.com>
michael left a comment (w3c/editing#511) > @michael In the video example above, what is the selection at the time of compositionstart? The selection is the same collapsed cursor as before you start the composition (turn dictation on). However the underlined part (whole word) is the targetrange that the composition will affect, which is why I'd like to capture it at `oncompositionstart` @masayuki-nakano in most browsers I believe the selection will be the same as the composition target range at `oncompositionstart`, however on Samsung-Android this is different. E.g. when you start typing at the end of the word, it will start a composition that includes the whole word (so also here selection !== composition target range at compositionstart). There are two reasons I'd like to capture event.getTargetRanges() in oncompositionstart: 1) More intuitive: It avoids adding logic to onbeforeinput to capture the target range before the composition starts (see relevant [code](https://github.com/michael/svedit/blob/ce56d875dc8d57a28e4aa413697a639c5d3e23d4/src/lib/Svedit.svelte#L108-L112) in my editor) 2) Also covers the special case where there's `oncompositionstart` followed by `oncompositionend` directly, with no `onbeforeinput` in between, like in the Samsung Android Dictation On/Off scenario. Here's a relevant [workaround](https://github.com/michael/svedit/blob/ce56d875dc8d57a28e4aa413697a639c5d3e23d4/src/lib/Svedit.svelte#L239-L242) to avoid the problem shown in the video. -- Reply to this email directly or view it on GitHub: https://github.com/w3c/editing/issues/511#issuecomment-3548969950 You are receiving this because you are subscribed to this thread. Message ID: <w3c/editing/issues/511/3548969950@github.com>
Received on Tuesday, 18 November 2025 18:16:05 UTC