bustle / mobiledoc-kit

A toolkit for building WYSIWYG editors with Mobiledoc
https://bustle.github.io/mobiledoc-kit/demo/
MIT License
1.55k stars 150 forks source link

Text suggestions and autocorrect don't work on iOS #761

Open JBYoshi opened 2 years ago

JBYoshi commented 2 years ago

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

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.

kevinansfield commented 2 years ago

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.

s00500 commented 2 years ago

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

JBYoshi commented 2 years ago

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 commented 2 years ago

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