Opened 13 years ago

Closed 12 years ago

#1621 closed defect (fixed)

DnD fails when scrolled down in a box with overflow:auto

Reported by: guest Owned by: psowden
Priority: high Milestone: 0.9
Component: DnD Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

When scrolled down in a box with overflow:auto, you can drag items, but you can't drop them. Affects at least FF1.5 and Opera (IE6 not affected).

Attachments (1)

dndtest.zip (944 bytes) - added by guest 13 years ago.

Download all attachments as: .zip

Change History (7)

Changed 13 years ago by guest

Attachment: dndtest.zip added

comment:1 Changed 13 years ago by dylan

Milestone: 0.4.1

comment:2 Changed 13 years ago by bill

Milestone: 0.4.10.5

comment:3 Changed 13 years ago by guest

Damn. I was really hoping this would get fixed for 0.4.1. Who do I have to bribe in order to get this prioritized?

comment:4 Changed 13 years ago by guest

Is this the same issue as #1875 ? If so, you can temporarily patch your 0.4.x version. In src/dnd/HtmlDragManager.js -- cacheTargetLocations:

//   var bb = dojo.html.getBorderBox(tn);
var bb = { width: tn.scrollWidth, height: tn.scrollHeight };

You'll also have to change that line in dojo.js(.uncompressed.js) if you're using a build like kitchen sink.

comment:5 Changed 13 years ago by guest

Thanks a lot for the heads up. I haven't quite solved the problem though. Using scrollHeight as opposed to getBorderBox().height does solve the issue in Firefox, but it breaks IE. I'm also not sure it's the correct solution to the problem. Using getBorderBox() seems sane considering what we want is to know the top left point and the bottom right point of the target. I've done some digging around and I think the root of the problem is that dojo.html.getAbsolutePosition() does not take into account the scrolled height of the target node in Firefox. This results in the target box ending up all over the place vertically. In IE, it appears to work though.

If I apply this patch

http://trac.dojotoolkit.org/ticket/1625

and change

var scroll = dojo.html.getScroll();

to

var scroll = dojo.html.getScroll(node);

in dojo.html.getAbsolutePosition(), I get good results in both IE and Firefox. Here are two tests. The first one is a non-modified version of HEAD and the second one is HEAD but with the above changes applied.

http://punbb.org/dojotest/trunk/tests/dnd/test_scroll.html http://punbb.org/dojotest2/trunk/tests/dnd/test_scroll.html

It should be noted that Opera fails both tests. I have no idea how Safari performs.

I look forward to hearing what the devs have to say about this. I am in no way a Javascript developer, so for all I know, I could be completely wrong about this.

comment:6 Changed 12 years ago by Eugene Lazutkin

Resolution: fixed
Status: newclosed

Fixed in 0.9.

Note: See TracTickets for help on using tickets.