event.preventDefault()
in onKeyDown
does not prevent Slate's default behavior.
#4357
BiosSun
started this conversation in
Feature Requests
Replies: 2 comments
-
@12joan do you have some thoughts on that? |
Beta Was this translation helpful? Give feedback.
0 replies
-
It sounds like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When using
event.preventDefault()
inside anonKeyDown
handler in a Plate plugin, it does not stop Slate's default behavior as expected. For example, consider the following plugin:I believe the issue is caused by the following line of code in
pipeHandler.ts
:plate/packages/core/src/react/utils/pipeHandler.ts
Lines 42 to 61 in e985bfe
Currently, the condition is:
However, it should also check whether the default action has been prevented, like this:
This behavior was correct in earlier versions but was changed in this commit. I'm not sure of the rationale behind this modification, but it seems to have introduced the issue.
Reproduction URL
No response
Steps to Reproduce
onKeyDown
handler that callsevent.preventDefault()
.Hotkeys.isMoveBackward
).Plate version
42.0.1
Slate React version
0.112.0
Browsers
No response
Beta Was this translation helpful? Give feedback.
All reactions