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

Drag Event interrupting the Context Menu #299

Closed
zeeshanjan82 opened this issue Oct 21, 2015 · 3 comments
Closed

Drag Event interrupting the Context Menu #299

zeeshanjan82 opened this issue Oct 21, 2015 · 3 comments

Comments

@zeeshanjan82
Copy link

I have created a fiddle to explain my point: http://jsfiddle.net/zeeshanjan/oqdvhLd5/
In this example we can notice that when we try to right click using the mouse then we are able to see 2 options in the context menu which appears on either of the boxes. However when I try to do the same on a touch device like a tablet, I am able to notice that 'hold' event does not really fire and instead any event which is related to the Context Menu gets interupted by the Drag event and the context menu is not displayed.
Is there any example of the Context Menu implementation using Interact.js

@taye
Copy link
Owner

taye commented Oct 27, 2015

Use the Interactable.preventDefault method:

interact(target)
  .preventDefault('never')
  .on('move', function (event) {
    // only prevent default if currently interacting
    if (event.interaction.interacting() /* or someOtherCondition */) {
      event.preventDefault();
    }
  });

@taye taye closed this as completed Nov 8, 2015
@zeeshanjan82
Copy link
Author

I have tried the solution but after I tap the red box with 2 fingers I can see the context menu and till here everything seems fine but then the move event does not work if I try moving the red box. Please suggest. I have updated the fiddle here: http://jsfiddle.net/oqdvhLd5/2/

@taye
Copy link
Owner

taye commented Apr 8, 2016

I think you need to prevent the contextmenu event. See #138 (comment).

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

2 participants