Unexpected text input on latest Android Mobile
See original GitHub issue[Edit]: After creating this issue I noticed this may be a duplicate of https://github.com/ianstormtaylor/slate/issues/3112
The following is recorded using crossbrowsertesting.com with the latest android (Android Google Pixel 3 / 9.0 Chrome Mobile 77) I’ve also seen similar behavior on older versions of android and chrome mobile.
I started noticing these issues when I was getting the following errors however I couldn’t reproduce these in development so I figured it was a device specific issue.
Object.toSlatePoint: Cannot resolve a DOM point from Slate point: {"path":[0,1,0],"offset":106}
Object.toSlatePoint: Cannot resolve a Slate point from DOM point: [object Text],108
The video doesn’t directly lead to these errors however the video’s behavior is an issue in itself and I believe the errors are a result of entering text in a blank editor on those devices however clearing out the editor is nearly impossible.
Slate: 0.54 Browser: Chrome Mobile 77 OS: Android 9
May also be related: https://github.com/ianstormtaylor/slate/issues/3309
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:5 (1 by maintainers)
Top GitHub Comments
FYI I am also getting this issue on Mac/Chrome 79 when using 0.57.1. It’s not blocking me though so just adding a note here in hope helps debug the issue.
I am rendering a small button into the corner of a table cell and then when that button is clicked I show a small popup menu. I then click an option, e.g. Add column, and this error is logged before my event handler fires:
The stack trace is:
The error originates from this handler: onDOMSelectionChange. Inspecting the code, it looks like onDOMSelectionChange is expecting slate nodes only and not dynamic nodes like I am including.
My code looks like this. Note the dynamic nature of the menu which is included for the focused cell only
The UI:
All these issues are the same: users are trying to set new
value
without reseting internalselection
. Slate editor have to usegetDerivedStateFromProps
and automatically fix or reset internal selection when newvalue
appears (nextProps.value !== prevState.value
).These issues can be fixed by core developer of slate only, because it requires change of project design. Users can only try to reset selection in a any dirty way.
The easiest way to provide dirty hack is to find a special case which breaks internal selection and use it to recreate slate editor completely. For example: