Opened 11 years ago

Closed 4 years ago

#3177 closed bug (fixed)

click is fired for draggagble elements on mouseUp

Reported by: paul.p.carey@… Owned by:
Priority: major Milestone: 1.7
Component: ui.mouse Version: 1.6rc2
Keywords: click mouseup drag Cc:
Blocked by: Blocking:

Description

Functions bound to the click event of an element are fired when a drag is terminated - on the mouseUp event.

I consider this a bug as dragging and clicking are distinct actions.

Attachments (1)

click-prevention.patch (1.3 KB) - added by Scott González 10 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 11 years ago by Cloudream

Milestone: TDB

comment:2 Changed 10 years ago by paul

Milestone: TBD1.6
Resolution: fixed
Status: newclosed
Version: 1.5.21.6rc2

Fixed in r856.

comment:3 Changed 10 years ago by paul.p.carey@…

This still occurs in 1.6rc6.

<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01EN" "http://www.w3.org/TR/html4/strict.dtd"> <html>

<head>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script> <script src="http://ui.jquery.com/repository/tags/testing/ui/minified/jquery.ui.all.min.js" type="text/javascript"></script> <script type="text/javascript">

$(document).ready(function () {

$("#foo").draggable(); $("#foo").click(function () { console.log("fired!"); });

});

</script>

</head> <body><div id="foo">foo</div></body>

</html>

comment:4 Changed 10 years ago by Scott González

Component: ui.draggableui.core
Priority: minorblocker
Resolution: fixed
Status: closedreopened

A partial fix that's doable right now is to add in event.stopImmediatePropagation() in the click handler. This will work for this test case, but not for the case where the original click event is bound before the element is made draggable.

A proper fix for this requires the ability to always be able to bind a handler as the first handler. I've talked to Ariel about this and have some ideas that I'll try out tomorrow.

comment:5 Changed 10 years ago by Scott González

Owner: changed from paul to scott.gonzalez
Status: reopenedaccepted

comment:6 Changed 10 years ago by Scott González

Proposed solution on jquery-dev.

Changed 10 years ago by Scott González

Attachment: click-prevention.patch added

comment:7 Changed 10 years ago by Scott González

Milestone: 1.61.next
Owner: scott.gonzalez deleted
Status: acceptedassigned

Fixed for the case where the user's click events are bound after the element is made draggable in r2080.

Bumping to 1.next for a more complete solution (too large of an impact this late in the release cycle).

comment:8 Changed 9 years ago by Jörn Zaefferer

Component: ui.coreui.mouse

Should be handled as part of the interactions rewrite.

comment:9 Changed 9 years ago by Jörn Zaefferer

Priority: blockercritical

comment:10 Changed 9 years ago by Scott González

Priority: criticalmajor

comment:11 Changed 7 years ago by Scott González

Milestone: 1.next2.0.0
Status: assignedopen

comment:12 Changed 4 years ago by Scott González

Milestone: 2.0.01.7
Resolution: fixed
Status: openclosed

I'm going to close this as fixed in 1.7. The more complete solution that I proposed a long time ago isn't something we should really implement.

Note: See TracTickets for help on using tickets.