Inline decoration on Android with word prediction enabled


I ran across the following issue. I made a plugin that helps me insert emoticons when the user types something like ‘:[a-z]’. I have a state field that determines when the emoticon hint should appear and disappear and an inline decoration that wraps the short name in a span with a highlight style. This works just fine on desktop and on Android devices while word prediction is not turned on. As soon as I turn word prediction on, the inline decoration does not apply anymore. Is there anything I can do to make it work?


Android text input heavily uses “composition” (also used for things like Chinese IME on desktop browsers), where the interface is in a special state while a bit of input is being composed through some platform-specific interface (in the case of Android, the virtual keyboard). Unfortunately, if ProseMirror messes with the DOM near the cursor while composition is in progress, the browser will reset the composition state, which is very annoying for users when they were expecting to be able to use composition. For this reason, ProseMirror holds back on applying decorations near the cursor during composition… and it sounds like that’s what you are running into here.

Indeed, I changed a bit the design to overcome this problem, all good.