zyzo / react-dnd-mouse-backend

Mouse Backend for react-dnd library
http://zyzo.github.io/react-dnd-mouse-backend/
MIT License
85 stars 30 forks source link

Revert 'Prevent click event after item has been dragged' from #7 #23

Closed b-cooper closed 5 years ago

b-cooper commented 5 years ago

7 includes a flag and handler to ignore the first 'click' event directly after dropping an item.

It's unclear why this change was needed and it causes unexpected functionality in my application.

In my application, after dragging and dropping an item, my next click on anything within the window is swallowed, the next click after that is registered.

This is because of the this.preventClick flag being set to true on drag end and subsequently to false after a window 'click' event.

@qtsd has already forked and reverted the change, plus some. I've just reverted the click handler addition here.

In the meantime, until this is merged and released, the last released version react-dnd-mouse-backend@0.1.2 does not have this 'click-swallowing' behavior.

mfolnovic commented 5 years ago

@zyzo bump :)

zyzo commented 5 years ago

Indeed, can't remember why I thought this was a good idea. @ndbroadbent feel free to challenge

ndbroadbent commented 5 years ago

Hi, sorry that was causing problems! In my app, when I clicked down and then dragged something, releasing the left mouse button would cause the click event to be fired. This caused some UX problems in my app (because a click and a drag were handled differently.) I think that's what I was trying to prevent here, but it must have been a brittle workaround if it was causing other problems.

I'm happy to just keep using this change in my own fork for now, or maybe someone can figure out a better fix for this "click after drag" issue.

zyzo commented 5 years ago

Cool, if you still stumble on the problem, feel free to open an issue with a minimal project example, I'd be happy to investigate

ndbroadbent commented 4 years ago

Hello, just letting you know that I do still need this commit in my app, otherwise there's a "left click" event that is fired after the drag event finishes. In my app, this causes a UX problem because the left click is also handled.

@b-cooper Do you think there might be some other way that we can fix this without causing problems in your app?