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

Slate selection doesn't update when dragging browser selection focus into contentEditable={false} element #5714

Closed
TyMick opened this issue Sep 6, 2024 · 0 comments · Fixed by #5716

Comments

@TyMick
Copy link
Contributor

TyMick commented Sep 6, 2024

Description

When I drag my browser selection focus into a contentEditable={false} DOM element that's being rendered by a non-void Slate element renderer, Slate's selection doesn't get updated. At times, this causes non-highlighted text to be deleted when pressing Backspace (first recording below). At other times, this causes a Backspace press to crash the page (second recording below).

Recording

A demonstration of the bug in Slate's checklists example, in which pressing Backspace causes non-highlighted text to be deleted

A demonstration of the bug in Slate's checklists example, in which pressing Backspace causes the page to crash

Sandbox

https://www.slatejs.org/examples/check-lists

Expectation

In the above recordings, that only the visually highlighted text would be deleted on Backspace and that the page would not crash.

Environment

  • Slate Version: main (confirmed locally with 7e77a93)
  • Operating System: Windows 11
  • Browser: Chrome, Firefox

Context

I'm in the process of working on a fix, since this bug affects my project (we have a block type that renders a larger contentEditable={false} element above its text content, so it's a bit easier to trigger). I'll submit a PR once that's ready; just wanted to give y'all a heads-up here first.

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.

1 participant