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

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

Merged
merged 1 commit into from
Feb 17, 2019
Merged

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

merged 1 commit into from
Feb 17, 2019

Conversation

b-cooper
Copy link
Contributor

@b-cooper b-cooper commented Jan 4, 2019

#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
Copy link

@zyzo bump :)

@zyzo
Copy link
Owner

zyzo commented Feb 17, 2019

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

@zyzo zyzo merged commit 2b05924 into zyzo:master Feb 17, 2019
@ndbroadbent
Copy link

ndbroadbent commented Feb 17, 2019

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
Copy link
Owner

zyzo commented Feb 17, 2019

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

zyzo pushed a commit that referenced this pull request Feb 17, 2019
feat:
- revert: Revert 'Prevent click event after item has been dragged' from (#7) #23
- revert: revert disable dragstart event preventDefault (#7) #25

docs:
- add public storybook http://zyzo.github.io/react-dnd-mouse-backend/
- add NestedTargets example
zyzo pushed a commit that referenced this pull request Feb 17, 2019
feat:
- revert: Revert 'Prevent click event after item has been dragged' from (#7) #23
- revert: revert disable dragstart event preventDefault (#7) #25

docs:
- add public storybook http://zyzo.github.io/react-dnd-mouse-backend/
- add NestedTargets example
@ndbroadbent
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants