-
-
Notifications
You must be signed in to change notification settings - Fork 834
Fix Hangul typing does not work properly #4339
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jungeonkim, thank you for working on this!
We'll need you to sign off on your code, as described in here, just writing this here will do:
Signed-off-by: Your Name <your@email.example.org>
As for the code, it looks somewhat sensible, but I'm not sure what is going wrong when you hit your problem. Could you elaborate a bit how this fixes the problem?
What browser version are you using?
What kind of input events are you seeing between compositionstart
and compositionend
? Could you provide a screenshot of typing your sequence in this tool to get a log of all the events?
Perhaps once clarified, we can add more comments in the code to explain how and what this fixes, so future modifications don't undo it.
Thank you!
Thank you for the extra information. I'm still not 100% sure how this fix works though. Concretely, I'm interpreting your explanation as something is going wrong in this sequence, here simplified with only two compositions:
Is the problem that the DOM does not get updated between the two compositions and therefore the first composition is lost or something? Is that what your added condition addresses, to not block the deferred DOM updates between two compositions to not loose the first composition? Sorry for the detailed questioning, I'm applying extra caution here, as I don't want to break anything for other input languages or browsers, and would like to document the problem in the code so we don't regress in the future. |
In the current implementation, If keep typing in Hangul only unless typing a character that doesn't use Hangul IME, the model is not updated because _isIMEComposing is true in _onInput via compositionend and _onInput by input event. |
Right, I understand now, thank you. I think that the PR, as it stands, might regress element-hq/element-web#10646. I'm not immediately sure how to solve this. It sounds like:
None of this is being made easier by the fact that it is very hard to test all the combinations of this. I'll have a think about what we can do about this... |
I have confirmed that the japanese ime on macOS works fine, but I haven't tested on other cases. |
@jungeonkim Could you try if using Promise.resolve().then(() => {
this._onInput({inputType: "insertCompositionText"});
}); |
While I'd still prefer a less intrusive solution, that is good to know 👍 |
It fixes the problem on macOS. I am trying to test it in other environments too. |
compositionstart event may fire in the meantime because compositionend event is being processed asynchronously. Signed-off-by: JungEon Kim <me@jungeon.kim>
I have confirmed that it solves the problem on Windows and macOS (chrome, electron app) and fixed the PR. |
Great, thank you!! |
compositionstart event may fire in the meantime because compositionend event is being processed asynchronously.