Interactive node views can be dragged bypassing the drag handle (to no avail) #3518
Closed
1 of 2 tasks
Labels
Type: Bug
The issue or pullrequest is related to a bug
What’s the bug you are facing?
It's possible to drag an interactive node view without using the drag handle. The drag doesn't actually do anything, presumably because it only works when the drag handle is used.
Which browser was this experienced in? Are any special extensions installed?
Latest Chrome, no extensions.
How can we reproduce the bug on our side?
It can be seen in the drag example: https://tiptap.dev/guide/node-views/examples#drag-handles
Screen.Recording.2022-12-08.at.15.04.23.mov
Can you provide a CodeSandbox?
Doesn't seem to be necessary.
What did you expect to happen?
Drag should only be possible by using the drag handle.
Anything to add? (optional)
I was able to narrow it down to this line of code:
tiptap/packages/core/src/NodeView.ts
Line 127 in 5380758
It seems that a node view renderer, due to being contentEditable, is considered an input, and the function returns too early, without a chance to cancel the event here:
tiptap/packages/core/src/NodeView.ts
Line 148 in 5380758
I was able to resolve this by patching the library so that the check looks like this:
(isInput && !isDropEvent && !isDragEvent)
. However, I'm not sure what's going on here, and it might be better to always exclude the renderer here (I'm not sure how to do this).Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: