Skip to content

Why is there a click event after simulate drag? #11

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

Closed
wants to merge 1 commit into from

Conversation

pscheit
Copy link

@pscheit pscheit commented Jan 29, 2013

Hello Everyone,

i just want to pull this to make a point. Why is there an aditional click event triggered?
Normally dragigng is just:
mousedown - moveit - mouseup
isn't it?

Is some strange browser doing this?

best regards
Philipp

@mikesherov
Copy link
Member

@pscheit, no, it isn't. If you hold down your mouse, drag, and then mouseup, the click event gets fired right after.

@mikesherov mikesherov closed this Jan 29, 2013
@mikesherov
Copy link
Member

@pscheit, thanks for contributing and taking the time to provide a patch though. Please feel free to peruse the open issues, and provide patches for any open issues.

@gnarf
Copy link
Member

gnarf commented Jan 29, 2013

@mikesherov assuming you mouseup in the same element you mousedown'ed and there aren't any preventDefault's involved... :)

@mikesherov
Copy link
Member

@gnarf37, which is what simulateDrag intends to emulate :-)

@mikesherov
Copy link
Member

@gnarf37, certainly it make be made way less brittle. I suppose we should check that the mouse is within the same element.

@pscheit
Copy link
Author

pscheit commented Jan 29, 2013

this maybe off-topic, it may be related:

i have the case, that when i use simulate, my application gets with the following code to the click event:
when i use my own mouse (firefox 18.0.1 windows) the click event is not triggered:

this is triggered (while dragging) with simulate, and isnt triggered (while dragging) with mouse

$someDiv.on('click', '.child-element-class', function (e) {
  var $childElement = $(e.currentTarget);
});

this isn't triggered (while dragging) with simulate, and isnt triggered (while draggin) with mouse

$someDiv.on('click', function (e) {
  var $childElement = $(e.target);
  if ($childElement.is('.child-element-class')) {
  }
});

i expect both pieces of code to trigger or not to trigger consistent with mouse

thank you for your clarification anyway!

@mikesherov
Copy link
Member

@pscheit, that may be a legitimate bug. Please file a new issue for that with a full test case showing the HTML you've used as well. Thanks agian!

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.

3 participants