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

Click events #71

Open
goshua13 opened this issue Sep 17, 2021 · 4 comments
Open

Click events #71

goshua13 opened this issue Sep 17, 2021 · 4 comments

Comments

@goshua13
Copy link

I have been trying to use onDoubleClick and onClick but those events are not working. do you have a workaround?

@AlexShaposhnykov
Copy link

Any update on this? I'm having the same issue.

When I nest a button inside my draggable element and try to initiate a drag event by holding and moving my cursor(onMouseDown event to be more exact) over it - nothing works, which is very strange. The issue seems to be that react-movable initiates a drag during the onClick event, which makes interacting with any nested clickable elements pretty much impossible.

Perhaps we can change the logic here a little bit? For example, react-movable could listen for the onMouseDown event and initiate drag after some delay(~200ms)/or movement. This way, we could differentiate between the actual drag event and the onClick event.

@tajo
Copy link
Owner

tajo commented Jan 23, 2022

react-movable could listen for the onMouseDown

That's how it already works.

Can you provide an example?

@AlexShaposhnykov
Copy link

Sure! I created a small code sandbox that illustrates the problem: https://codesandbox.io/s/musing-dan-cbjs5?file=/src/App.tsx. In my case, buttons should act as drag handles and also preserve their original click functionality

@tajo
Copy link
Owner

tajo commented Feb 9, 2022

Oh, you can't have it both ways. I would recommend a dedicated drag handle button and another button next to it.

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

No branches or pull requests

3 participants