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

Interactive node views can be dragged bypassing the drag handle (to no avail) #3518

Closed
1 of 2 tasks
fenok opened this issue Dec 8, 2022 · 1 comment · Fixed by #3677
Closed
1 of 2 tasks

Interactive node views can be dragged bypassing the drag handle (to no avail) #3518

fenok opened this issue Dec 8, 2022 · 1 comment · Fixed by #3677
Labels
Type: Bug The issue or pullrequest is related to a bug

Comments

@fenok
Copy link

fenok commented Dec 8, 2022

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:

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:

event.preventDefault()

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?

  • Yes, I’ve updated my dependencies to use the latest version of all packages.

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖
@fenok fenok added the Type: Bug The issue or pullrequest is related to a bug label Dec 8, 2022
@imownbey
Copy link

We are also running into this, it makes using a drag-handle on a contenteditable="false" basically useless and also disables selecting any text inside that component (because clicking anything will instead begin dragging)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants