event.preventDefault()
in onKeyDown
does not prevent Slate's default behavior.
#3994
Labels
bug
Something isn't working
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
The text was updated successfully, but these errors were encountered: