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

Chrome 112 crashes editor after presence of tab in content #5390

Closed
dylans opened this issue Apr 10, 2023 · 5 comments
Closed

Chrome 112 crashes editor after presence of tab in content #5390

dylans opened this issue Apr 10, 2023 · 5 comments
Labels

Comments

@dylans
Copy link
Collaborator

dylans commented Apr 10, 2023

Description
A clear and concise description of what the bug is.

Cross-reported at https://bugs.chromium.org/p/chromium/issues/detail?id=1431935

Steps
To reproduce the behavior:

  1. Chrome 112, https://www.slatejs.org/examples/richtext , paste some content with a tab character
  2. You'll see double characters added
  3. Eventually the editor crashes

Expectation
No duplication of text characters or inconsistency between Slate state and DOM

Environment

  • Slate Version: latest
  • Operating System: any
  • Browser: Chrome 112
@dylans dylans added the bug label Apr 10, 2023
@dylans
Copy link
Collaborator Author

dylans commented Apr 14, 2023

Observed that this issue only happens when typing a-zA-z or space.

That led me to this line: https://github.com/ianstormtaylor/slate/blob/main/packages/slate-react/src/components/editable.tsx#L496

There's a check in Slate to support React's native vs. non-native event handling for beforeInput events, e.g. facebook/react#11211

If I change https://github.com/ianstormtaylor/slate/blob/main/packages/slate-react/src/components/editable.tsx#L502 to native = false for Chrome, works around this issue, but it's unclear why.

It's as if the native event is getting treated as a long-press event.

So I would feel much better if I knew what caused this regression for Slate in Chrome 112 (intentional or not)

@tusher-A
Copy link

I have faced the same issue and the regression came from production and from a customer. I also want to know the root cause for this regression. But is there any short way to solve this on developer side for now? @dylans

@dylans
Copy link
Collaborator Author

dylans commented Apr 18, 2023

Short term fix is something along the lines of "change https://github.com/ianstormtaylor/slate/blob/main/packages/slate-react/src/components/editable.tsx#L502 to native = false"

There is some update from the Chrome team, so they are looking into it and know roughly what change to Chromium caused the regression: https://bugs.chromium.org/p/chromium/issues/detail?id=1431935#c7

@dylans
Copy link
Collaborator Author

dylans commented Apr 20, 2023

Fix has landed in Chrome. Unclear exactly when it will land, but it looks like in both a patch release of 112 and in 113.

@dylans dylans closed this as completed Apr 20, 2023
@sibljon
Copy link

sibljon commented Apr 26, 2023

Hi everyone. Thanks for all the hard work reproducing and investigating so far. This issue was helpful to me, as was the link to the Chromium issue.

I just tested in Chrome 112 and 113 and neither seems to have fixed the issue. However, Chrome 114 has indeed fixed the issue. Here's a screencast of my testing, in case this is valuable to anyone.

As I understand it, there's chance that 112 or 113 will get the fix in a patch release, but that doesn't seem to have happened yet, and whether that is to happen or not seems unresolved in the Chromium issue. Would you consider making a patch to the Slate library for the time being? If I understand correctly, @dylans "short-term fix" requires us forking Slate, correct?

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

No branches or pull requests

3 participants