mobiledoc-kit icon indicating copy to clipboard operation
mobiledoc-kit copied to clipboard

Text suggestions and autocorrect don't work on iOS

Open JBYoshi opened this issue 3 years ago • 4 comments

When typing into the editor on iOS, the text suggestion bar doesn't behave normally:

  • The first letter typed acts as if it is its own word (for example, typing "H" suggests "h I", "h is", "h you").
  • Further letters typed do not update the suggestions.
  • Typos are not suggested for autocorrect, even when they would be in other contexts.

Based on my research into this issue, it seems to be related to calling preventDefault() on the key events. Using onbeforeinput instead does not have this problem.

Video: https://user-images.githubusercontent.com/12983479/145438053-7c590790-52fe-42ff-a994-225f2005035c.mov

Tested on https://bustle.github.io/mobiledoc-kit/demo/debug.html using Safari on iOS 15.1. Originally reported as https://github.com/TryGhost/Ghost/issues/13097.

JBYoshi avatar Dec 09 '21 16:12 JBYoshi

This is a rough duplicate of https://github.com/bustle/mobiledoc-kit/issues/621 - there's a lot more details in there about the cause if anyone wants to dig in and work on a PR.

kevinansfield avatar Dec 09 '21 16:12 kevinansfield

@JBYoshi This seems to be linked to inserting emoji as well, do you have a repo of you experiments you did so far?

s00500 avatar Aug 08 '22 21:08 s00500

It's been a while since I looked at this, but I pushed a copy of my workspace with some work-in-progress stuff. https://github.com/JBYoshi/mobiledoc-kit/commit/66a36a4cc0fcf859759358912ad99ff3804c0758 is the original state of my workspace last I worked on it. I've merged in the latest changes to https://github.com/JBYoshi/mobiledoc-kit/tree/input-events.

JBYoshi avatar Aug 10 '22 02:08 JBYoshi

For the emoji setup, it turns out that there is a separate piece of the code that's not behaving properly; using input events instead just bypasses the broken code. I created a separate PR to fix the original bug with emojis: https://github.com/bustle/mobiledoc-kit/pull/764

JBYoshi avatar Aug 11 '22 01:08 JBYoshi