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

Easy repro crash when triple clicking #4930

Closed
scottlu opened this issue Apr 8, 2022 · 4 comments
Closed

Easy repro crash when triple clicking #4930

scottlu opened this issue Apr 8, 2022 · 4 comments
Labels

Comments

@scottlu
Copy link

scottlu commented Apr 8, 2022

Description

Very easy to reproduce crash. Simply triple click in an area of Editable not occupied by a child element. See Context below for the lines of code that are causing it.

The bug was introduced very recently, 4/4/22, PR #4914, meant to fix issue #3871

Recording

simplescreenrecorder-2022-04-07_20.35.13.mp4

Sandbox

https://codesandbox.io/s/slate-reproductions-forked-j0e6qq

Steps
To reproduce the behavior:

  1. Open the sandbox
  2. Ensure the sandbox is using slate 0.76.1, slate-react 0.76.1, and slate-history 0.66.0
  3. Triple click in the Editable's padding area, not on the child element
  4. Crash

Expectation

Not to crash.

Environment

  • Slate Version: slate 0.76.1, slate-react 0.76.1, slate-history 0.66.0
  • Operating System: [Debian Bullseye]
  • Browser: [Chrome]

Context

The problem is the TRIPLE_CLICK code merged on 4/4/22, PR #4914, in slate-react/src/components/editable.tsx, line ~1503. In the case of triple clicking on the Editable component itself, the node returned from toSlateNode is the editor node, and the path returned from findPath is of zero length. The code inside the TRIPLE_CLICK conditional appears to not take into account the the node is the editor, or that the path length may be zero.

@scottlu scottlu added the bug label Apr 8, 2022
@benbrandt
Copy link

Also seeing this behavior

@zijizhu
Copy link

zijizhu commented Apr 11, 2022

Yeah I can also reproduce this. Any potential fix?

@JosNun
Copy link

JosNun commented May 4, 2022

Is this fixed by #4944?

@BitPhinix
Copy link
Contributor

Yes, this can be closed

@dylans dylans closed this as completed May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants