Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac's Text Replacement Doesn't Work #3087

Closed
benawad opened this issue Nov 1, 2019 · 2 comments
Closed

Mac's Text Replacement Doesn't Work #3087

benawad opened this issue Nov 1, 2019 · 2 comments

Comments

@benawad
Copy link

benawad commented Nov 1, 2019

Do you want to request a feature or report a bug?

bug

What's the current behavior?

slateg

What's the expected behavior?

omw should get deleted

@ryanmitts
Copy link
Contributor

ryanmitts commented Nov 5, 2019

Maybe this comment will be helpful in the future. I tried this in my CR that has native browser manipulation on simple insertions (#3076) and it also breaks. I'm new to all the InputEvent stuff, but seems like the beforeinput event is the synthetic React one. It looks the same as an insertText event, so I don't know a way to know if it's replacing text without looking at the DOM change after allowing the native manipulation to proceed. Problem is, Chrome messes up and deletes a lot of the nested elements for the text Nodes, so it breaks the Slates' reconciliation (maybe this is a bug, if I have more time I'll look into this, seems like DraftJS has had problems with Chrome unexpectedly changing if allowing native events).

I tried what happens in Chrome outside of React using the native beforeInput event which should support InputEvents level two, but it also reports as inputType of insertText. This doesn't make sense as the spec makes it seem like insertReplacementText is more appropriate. Using insertReplacementTest is how Safari reports the event. I raised a Chrome bug for for this in the meantime (1021460).

This may be fixable in Safari if we can use the native beforeinput event.

Another link for reference.

@ianstormtaylor ianstormtaylor mentioned this issue Nov 6, 2019
@ianstormtaylor
Copy link
Owner

Fixed by #3093.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants