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

Bug: Cannot find DOMPoint after applying formatting keyboard shortcuts (onDOMBeforeInput->event.inputType) - also in stock examples #3586

Open
beorn opened this issue Apr 6, 2020 · 1 comment · May be fixed by #5407

Comments

@beorn
Copy link
Contributor

beorn commented Apr 6, 2020

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

Bug

What's the current behavior?

  1. Go to https://www.slatejs.org/examples/hovering-toolbar
  2. Replace all content with just 'abc'
  3. Select the 'c'
  4. Press Cmd-B or Cmd-I
  5. The app crashes

Debugging locally it seems to Editor.node(editor, point.path) in toDOMPoint finds the wrong node when looking for the domPoint of domFocus.

  • Slate: 0.57.1 (latest)
  • Browser: Chrome/Electron (keybindings don't seem to work in Firefox / Safari)
  • OS: Mac

What's the expected behavior?

It should bold or italicize the c — the same behavior as pressing the formatting buttons in the hovering toolbar.

Screen Shot 2020-04-05 at 17 23 17

Screen Shot 2020-04-05 at 17 35 09

@beorn
Copy link
Contributor Author

beorn commented Apr 6, 2020

It seems that calling event.preventDefault() if handling the event seems to fix the error at least. I'm not sure if this is the right approach?

@zbeyens zbeyens linked a pull request Apr 27, 2023 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant