Issue with applying text marks (Bold, Italic, etc.) and first Korean character input not working correctly on Android smartphones

Hello,

Thank you for your efforts in developing ProseMirror.

This issue has been observed on the Samsung Galaxy S9+ (Android 10 / One UI 2.5) and the Samsung Galaxy S10+ (Android 12 / One UI 4.1). The same behavior occurs when accessing the ProseMirror.net website and using the example editor on the browsers of these devices.

Let me explain the issue in more detail. Let’s assume you’re entering the Korean text “가나다라” in an empty editor. The typing sequence for “가나다라” is as follows: “ㄱ”, “ㅏ”, “ㄴ”, “ㅏ”, “ㄷ”, “ㅏ”, “ㄹ”, “ㅏ”. When entering “가나다라” as plain text in an empty editor, the input works correctly and the result is “가나다라”. However, when the Mark feature (like Bold or Italic) is enabled and you input the same text, the following incorrect result is produced: “ㄱㅏ나다라”.

The Mark feature is applied correctly, but the input behaves as described above. The same issue occurs when starting a new line after pressing Enter. However, if you input the text first and then apply the Mark by selecting the text, the Korean text “가나다라” is correctly marked.

Here is an example image.

Thank you for your help.

Are you using the Samsung virtual keyboard or another one?

I am using the Samsung virtual keyboard and Gboard virtual keyboard, and the same issue occurs with both.

I can reproduce this, but it seems to be a Chrome bug. When ProseMirror inserts its cursor wrapper to make sure the composition text has the proper marks, that triggers some strange behavior in Chrome, causing it to leave the selection in front of, instead of after, the inserted character, and immediately aborts the composition. This may be hard to work around on the ProseMirror side (by the time it can be detected, the composition is already lost).

Thank you for your assistance.