Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#433 closed defect (fixed)

drag positioning is off for objects inside forms

Reported by: bill Owned by: bill
Priority: high Milestone:
Component: General Version: 0.2
Keywords: Cc:
Blocked By: Blocking:


Try dragging the list inside the form in test_dragmove.html. It jumps to the top of the screen when you start to drag it. Fails on both IE6 and FF1.5

Attachments (1) (7.9 KB) - added by [email protected] 16 years ago.
two new testcases, improved dnd code but not 100% ready

Download all attachments as: .zip

Change History (7)

comment:1 Changed 16 years ago by [email protected]

Priority: normalhigh

Copy of my mail to the dojo-interest mailing list: Subject: Re: [Dojo-interest] Drag and drop misaligned when embedded in scrolled div Date: Wed, 22 Feb 2006 15:23:21 +0100

I have now found the bug and a solution in the Dnd Code.

The symptom: To confirm that there is a bug in the recent trunk (revision 3155), try the test_dragmove.html test. If you drag the list after the row "This list is inside a form", you should see that the dragging starts from the top left of the page rather that from the correct position. At least it does for me in Firefox 1.07.

The cause: Some code was added which calculates a parentPosition in the onDragStart method of the HtmlDragObject? in the file HtmlDragAndDrop?.js. Then this parentPosition is subtracted from the actual position in onDragMove. This doesn't work.

The quick solution: Change line two and three of the onDragMove method of said object.

var x = this.dragOffset.left + e.clientX;

removed - this.parentPosition.left;

var y = + e.clientY ;

removed -;

The big question: Why was the parentPosition code added? For me all the examples tests in the test files work correctly, but surely it must have been added for a reason? Is this related to browser specific problems? I haven't added IE to my Linux box yet, so I can't try it out now.

/Henrik Hjelte

On tor, 2006-02-16 at 13:14 +0100, henrik hjelte wrote:

On ons, 2006-02-15 at 15:41 -0500, Jon Pierce wrote:


I'm trying to incorporate Dojo's drag and drop functionality into an existing application. But I've noticed that it's misaligned when embedded in a scrolled div (e.g., one with style="overflow: auto" and more content than can fit). The misalignment seems proportional to the amount of scrolling. If you're at the very top, there's none. I'm using Dojo 0.2.2 but I've verified that this is still a problem in the trunk.

I just want to confirm that there are some problems. I've been away from dojo for a while, and have just updated my dojo trunk from something late last year to tonights svn repository. I had drag and drop of DIV:s in a splitPanePanel which used to work fine, but with the new version the dragged item "jumps" to the top-left of the page, not relative to the position in the panel. I think the position of the splitPanelPanel should be added to the start postion of the dragging. I can look more into this problem soon, if none of the real developers have a quick solution...

/Henrik Hjelte

Changed 16 years ago by [email protected]

Attachment: added

two new testcases, improved dnd code but not 100% ready

comment:2 Changed 16 years ago by anonymous

I've added two testcases for the dnd code that tests different positioning in stylesheets. refactored/improved the dnd code, but it isn't completely finished yet. Last time I looked some dragging was offset on IE. Unfortunately I have to leave this aside for a while, but if someone wants to continue with my code please do. It's in the attached file.

/Henrik Hjelte

comment:3 Changed 16 years ago by sjmiles

Milestone: 0.3release0.3.1

The drag'n'drop problem has been fixed. There is a larger issue with dragMove that will be fixed post-0.3.

comment:4 Changed 16 years ago by bill

Owner: changed from anonymous to bill
Status: newassigned

test_dragmoveparent.html still has problems, namely divs jumping out of position on drag start, especially inside of <form>'s.

comment:5 Changed 16 years ago by bill

Resolution: fixed
Status: assignedclosed

OK, I think I have fixed the test_dragmoveparent.html problem (famous last words) in [4285]

comment:6 Changed 15 years ago by (none)

Milestone: 0.3.1

Milestone 0.3.1 deleted

Note: See TracTickets for help on using tickets.