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.

Dropping a link follows it in Firefox.

See original GitHub issue

Describe the bug

I have an <a href=""> link element which I want to make also draggable. I had wrapped the link in a <span ref={drag}> to be sure. Previously this was fine; clicking it works as a link, but it also instead can be dragged. However, after upgrading react-dnd-html5-backend to the latest 14.0.0, this no longer works; as soon as it is dropped over a qualified element, the link is immediately followed. Dropping it elsewhere does not cause this. I only see the wrong behavior in Firefox, not Chrome.

I have traced it back to #2949. If I restore the e.preventDefault() in handleTopDropCapture, it works correctly. I don’t understand the code well enough to diagnose further. Maybe somehow that isDraggingNativeItem has browser differences.

Possibly related, but even the simple example here https://react-dnd.github.io/react-dnd/examples/dustbin/single-target does not work right for me in Firefox. When I drag into the box, the alert appears twice, whereas in Chrome it appears once. Furthermore, after the second alert, I get an “invariant violation” error in the console. This might not be the same problem, however.

Desktop (please complete the following information):

  • OS: Ubuntu Linux
  • Browser Firefox 87.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jgoneracommented, May 20, 2021

This looks like a regression. I didn’t have this problem on 11.x but it started happening after updating react-dnd to 14.0.2.

Seems similar to https://github.com/react-dnd/react-dnd/issues/221 which was fixed a long time ago.

1reaction
galenhuntingtoncommented, May 11, 2021

Adding .preventDefault() to the drop target’s onDrop as described in #3188 allowed me to work around this problem. I don’t know if that means it should be considered “fixed”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Drag and drop links and tabs to and from Firefox
With one finger, tap and hold on the link or tab so it enlarges. Then follow one of the steps below: Side-by-side view:...
Read more >
why can't i no longer drag and drop urls to my desktop!
Right-click a Firefox desktop shortcut, then click Properties ; Right-click a Firefox icon pinned to the Taskbar then right-click Mozilla Firefox ...
Read more >
How to stop firefox from forcing a new tab for "new" web pages?
The only way to stop this from happening is to navigate back 2 pages, losing the current page, before it starts the redirect...
Read more >
Link Drop – Get this Extension for Firefox (en-US)
Download Link Drop for Firefox. Get reminded of important links when it's convenient.
Read more >
EMAIL LINK DON'T WORK | Firefox Support Forum
Chosen Solution · Try Firefox Safe Mode to see if the problem goes away. · If Firefox is open, you can restart in...
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