Ticket #2532291 (closed defect)

Reporter


Jesse Foster
Opened: 05/8/12
Last modified: 08/1/12
Status: closed
Type: defect
Resolution: fixed

Owner


Dav Glass
Target Release: 3.6.0
Priority: P3 (normal)
Summary: DD Delegate ignores dragNode configuration option
Description:

DD Delegate allows you to pass in a configuration object, dragConfig, which is later used when creating the Drag instance. However during mousedown event handling the 'dragNode' configuration option
is overridden without checking the 'dragConfig' object first.

in _delMouseDown

if (dd.proxy) {
dd.set('dragNode', Y.DD.DDM._proxy);
} else {
dd.set('dragNode', tar);
}

instead it should be something like


if (dd.proxy) {
dd.set('dragNode', Y.DD.DDM._proxy);
} else if ( conf.dragNode ) {
dd.set('dragNode', conf.dragNode);
}else {
dd.set('dragNode', tar);
}

Type: defect Observed in Version: 3.5.1
Component: DragDrop Severity: S3 (normal)
Assigned To: Dav Glass Target Release: 3.6.0
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: All
URL:
Test Information:

Change History

Dav Glass

Posted: 05/8/12
  • location changed to Library Code
  • milestone changed to 3.6.0
  • priority changed to P3 (normal)
  • status changed from new to accepted

Dav Glass

Posted: 05/11/12
  • estimated changed from 0 to 0.25
  • remaining changed from 0 to 0.25
  • sprint changed to sprint 2

Dav Glass

Posted: 05/14/12
  • status changed from accepted to infoneeded

Can you provide a simple repro case?

I created a test for this and it passes with no modification to DD:

https://gist.github.com/2696768

Jesse Foster

Posted: 05/14/12
  • status changed from infoneeded to assigned

Sure, here's a quick example in JSFiddle, http://jsfiddle.net/GQkXH/. All the yellow boxes are draggable while the blue one is configured as the dragNode. If you drag the yellow box with just DD the dragNode(blue box) is physically dragged instead, which is supposed to happen. Under DD Delegate the yellow boxes are incorrectly dragged around since it's ignoring the 'dragNode' config option.

I did a quick patch in our copy of YUI 3.5 by editing _delMouseDown in dd-delegate


_delMouseDown: function(e) {
var tar = e.currentTarget,
dd = this.dd,
conf = this.get('dragConfig');

if (tar.test(this.get(NODES)) && !tar.test(this.get('invalid'))) {
this._shimState = Y.DD.DDM._noShim;
Y.DD.DDM._noShim = true;
this.set('currentNode', tar);
dd.set('node', tar);
if (dd.proxy) {
dd.set('dragNode', Y.DD.DDM._proxy);
}
else if ( conf.dragNode ) {
dd.set('dragNode', conf.dragNode);
}
else {
dd.set('dragNode', tar);
}
dd._prep();

dd.fire('drag:mouseDown', { ev: e });
}
}

Dav Glass

Posted: 05/15/12
  • status changed from assigned to accepted

I changed up the logic a little bit. I made it check config.dragNode before checking for proxy. That way if they want a custom proxy they can.

Dav Glass

Posted: 05/15/12
  • completed changed from 0 to 0.25
  • remaining changed from 0.25 to 0

Dav Glass

Posted: 05/15/12
  • resolution changed to fixed
  • status changed from accepted to checkedin

Fixes #2532291 - Added config check for dragNode test on mousedown
View Commit: f5f7dbff94a21f8722fe2074f12184c34ed3dc70

Jenny Donnelly

YUI Developer

Posted: 08/1/12
  • status changed from checkedin to closed

Shipped in 3.6.0. Marking closed/fixed.