Closed alanchrt closed 4 years ago
I can't find the older issue that discusses this problem right now, but you can workaround this with:
<Editor
onFocus={(event, change) => change.focus()}
/>
Thank you! This works for now.
So, it ends up that change.focus()
hack really messes with a lot of other things (focus is initially/briefly in the wrong spot when clicking into the editor, scroll position gets messed with to focus the other position, etc.).
Any idea what the underlying cause is?
Does it still happen without a placeholder?
Yeah, seems to happen with or without a placeholder. If the form is empty, you can't ever seem to be able to enter text. I tried to add that workaround above, but the editor throws an error. Same thing happens on the demo site:
Can you see if this is focused now with https://github.com/ianstormtaylor/slate/pull/2396 merged?
I can no longer reproduce the crash, which is great. Things generally work fine in empty editors that have the placeholder. But sometimes you get into this weird state where there is no placeholder (and there should be), and in those situations you can't type.
@shahkashani How you made that gif? Thank you.
@steida No problem! That one was made using the built-in iOS screen recorder and then converting the video to a GIF on ezgif.com! Hope that helps.
I believe that this may be fixed by https://github.com/ianstormtaylor/slate/pull/3093, which has changed a lot of the logic in Slate and slate-react
especially. I'm going to close this out, but as always, feel free to open a new issue if it persists for you. Thanks for understanding.
Do you want to request a feature or report a bug?
Bug.
What's the current behavior?
On mobile/touch devices, a tap on an empty
Editor
does not focus the editor. If the editor already has text, it's fine.In the GIF, there are multiple clicks/touches, but no focus. Here is the fiddle shown.
What's the expected behavior?
A tap on an empty
Editor
should focus for editing.