Search and Top Navigation
#7452 closed bug (notabug)
Opened June 06, 2011 07:22PM UTC
Closed June 06, 2011 09:43PM UTC
Last modified June 06, 2011 09:50PM UTC
dragstart event is triggered for disabled draggables
Reported by: | AD7six | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.draggable | Version: | 1.8.13 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
As shown in this image:
[[Image(http://ad7six.com/dump/jqueryui-draggable.png, 800px)]]
the dragstart event of a disabled draggable is still triggered.
For completeness (and in the event the image is deleted in the future) this code:
$('#draggable') .draggable('disable') .bind('dragstart', function() { alert("You started dragging"); } );
Will display an alert if you attempt to drag #draggable.
I'm not sure if this is by design, but it was certainly unexpected. So, either a documentation fix, me-education, or a code change appears to be in order :)
Attachments (0)
Change History (8)
Changed June 06, 2011 07:43PM UTC by comment:1
resolution: | → worksforme |
---|---|
status: | new → closed |
Changed June 06, 2011 08:03PM UTC by comment:2
Thank you for taking the time to really dig into the ticket :D - at least I can reopen it with these duplicate instructions.
I'm not sure how to create a test case for a mouse movement, so the steps to reproduce the problem are (I thought this was obvious, and I reproduced it right-now in Chrome 10 linux, Chrome 11 windows, Firefox 4.0 Window and IE 9 )
- Go to http://jqueryui.com/demos/draggable/
- Open the console and type
$('#draggable').draggable('disable');
- then type
type $('#draggable').bind('dragstart', function() { alert("You started dragging"); } );
- Drag the draggable (a few times in different places)
An alert will appear.
If it's not happening for you perhaps you could explain how I got that screenshot?
Changed June 06, 2011 08:26PM UTC by comment:3
Sorry, when I said "I'm not sure what steps you're using" I meant I didn't know if you had run those lines in the console then changed which demo you were using.
I've gotten confirmation from another developer that this is working properly for him too.
Changed June 06, 2011 09:05PM UTC by comment:4
Cool - Do either of you have a suggestion for
- how I got that screenshot (I could generate another one in any browser right now)
- how to write a suitable test case?
Alternatively, the output of dragging around on this http://jsbin.com/aboto4/7 is an alert and this debug output
jQuery.Event altKey: false attrChange: undefined attrName: undefined bubbles: true button: 0 cancelable: true charCode: 0 clientX: 64 clientY: 79 ctrlKey: false currentTarget: HTMLDivElement data: undefined detail: 0 eventPhase: 2 fromElement: null handleObj: Object handler: function (e) { window.top.console.log(e); window.top.console.trace(); alert("yes, you did it"); } isDefaultPrevented: function returnFalse() { jQuery16107274469290859997: true keyCode: 0 layerX: 56 layerY: 71 metaKey: false newValue: undefined offsetX: 56 offsetY: 71 originalEvent: MouseEvent pageX: 64 pageY: 79 prevValue: undefined relatedNode: undefined relatedTarget: null screenX: 64 screenY: 202 shiftKey: false srcElement: HTMLDivElement target: HTMLDivElement timeStamp: 1307394067445 toElement: HTMLDivElement type: "dragstart" view: DOMWindow wheelDelta: undefined which: 1 __proto__: Object
console.trace() (anonymous function)4:46 jQuery.event.handlejquery.js:2926 jQuery.event.add.elemData.handle.eventHandlejquery.js:2560
I can appreciate you're having difficulties reproducing but an almost immediate wfm seems pretty inappropriate given what appears to be a blatant problem - unless you think I would photoshop an alert onto a screenshot.
Changed June 06, 2011 09:24PM UTC by comment:5
Maybe this helps convince you to press that reopen-ticket button (go on, you know you want to):
This appears to be 100% reproducible:
- Select some text in a draggable (e.g. double click on a word in the draggable)
- Then drag the draggable.
- Alert every time for me.
Changed June 06, 2011 09:43PM UTC by comment:6
resolution: | worksforme |
---|---|
status: | closed → reopened |
Ok, so the text selection was the key. This isn't the draggable plugin though, that's a native dragstart event. That's unfortunate.
Changed June 06, 2011 09:43PM UTC by comment:7
resolution: | → invalid |
---|---|
status: | reopened → closed |
Changed June 06, 2011 09:50PM UTC by comment:8
would you mind explaining how unexpected behavior is invalid and how users can avoid this - or point at where in the documentation it tells users that this particular case is "correct"
I'm not sure what steps you're using, but there are no events being triggered for disabled draggables for me. Please provide a reduced test case if you continue having problems.