question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding data-drag-handle doesn't always work

See original GitHub issue

Describe the bug On a simple component, like the drag handle example, adding data-drag-handle makes dragging only work for that element.

On something more complicated, it doesn’t.

Steps to Reproduce / Codesandbox Example

  1. Go to https://codesandbox.io/embed/simplified-tiptap-editor-example-5s2k3
  2. Drag one of the “Set of fields” blocks from anywhere.

Expected behavior

Dragging should only work when dragging from the handle (the darker box on the top right with the =)

Additional context

I know that something could probably be done using stopEvent, but I can’t work out what. I tried something along those lines, but it would also affect events within the nested inputs.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JerryKusenbergercommented, Oct 7, 2020

@Greenscreener Could you please provide a code sample? I’m struggling with this right now. I tried adding the hidden div as suggested by the OP but that did not work for me. I’m able to click and drag but when I drop the element stays in it’s original position.

0reactions
JerryKusenbergercommented, Oct 8, 2020

Thank you. After a comparison the only difference I could find is that I was extending Mark and the example extends Node. After changing my element to extend node I can now drag and drop!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding data-drag-handle doesn't always work #481 - GitHub
Describe the bug On a simple component, like the drag handle example, adding data-drag-handle makes dragging only work for that element.
Read more >
React beautiful DnD drag out of position problem
I tried it, but doesn't work for me. I have a parent div which uses a transform, and that is causing the issue....
Read more >
Drag operations - Web APIs - MDN Web Docs - Mozilla
When the drag begins, you add data by providing a type and the data. ... This will often be true, but doesn't need...
Read more >
Row Dragging - JavaScript Data Grid
Row dragging is used to rearrange rows by dragging the row with the mouse. Download v28 of the best JavaScript Data Grid in...
Read more >
Drag and Drop functionality using react-beautiful-dnd
React-beautiful-dnd makes it easy to create drag and drop functionality, allowing you to drag and drop (dnd) in rows or columns just like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found