Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #4202 (closed defect: invalid)

Opened 3 years ago

Last modified 1 year ago

[PATCH] Droppables within overflow:auto divs with scrollbars not working correctly

Reported by: njaffer@opencrowd.com Assigned to: thomas@fesch.at
Priority: normal Milestone:
Component: script.aculo.us Version:
Severity: normal Keywords: dragdrop
Cc:

Description

When one has a div with style overflow:auto that has droppables registered within it, the Droppables.isAffected doesn't compensate for how much one has scrolled the element and as a result returns the wrong droppable if any based on the Event.pointerX and pointerY.

Changed dragdrop.js: Added option scrollingParent to Droppables.register which would indicate that the droppable is within an element that can scroll. If present for a droppable, it will add the scrollingParent's scrollLeft and scrollTop to the point[] in the isAffected method.

Diff attached based on version 1.5.3. Example attached as well, if one scrolls to the bottom of the div and tries to drag an item, one can see that the wrong droppables get affected based on positioning until the patch is applied.

Index: src/dragdrop.js =================================================================== --- src/dragdrop.js (revision 3848) +++ src/dragdrop.js (working copy) @@ -44,6 +44,9 @@

},

isAffected: function(point, element, drop) {

+ if (drop.scrollingParent) + point = [point[0] + $(drop.scrollingParent).scrollLeft, + point[1] + $(drop.scrollingParent).scrollTop];

return (

(drop.element!=element) && ((!drop._containers)

Attachments

dragdrop.js (21.6 kB) - added by anonymous on 03/12/06 20:16:57.
patched dragdrop.js
scrollingDivParent.diff (462 bytes) - added by anonymous on 03/12/06 20:18:00.
diff file for 1.5.3
scrollingDroppable.html (3.3 kB) - added by njaffer@opencrowd.com on 03/12/06 20:19:06.
Sample file

Change History

03/12/06 20:16:57 changed by anonymous

  • attachment dragdrop.js added.

patched dragdrop.js

03/12/06 20:18:00 changed by anonymous

  • attachment scrollingDivParent.diff added.

diff file for 1.5.3

03/12/06 20:19:06 changed by njaffer@opencrowd.com

  • attachment scrollingDroppable.html added.

Sample file

03/12/06 20:24:03 changed by njaffer@opencrowd.com

Forgot to add, tested with IE6.0, FF 1.5, and latest Konqueror.

03/18/06 22:36:55 changed by ulysses

  • status changed from new to closed.
  • resolution set to fixed.

(In [3953]) Change url_for to escape the resulting URLs when called from a view. Closes #4202

03/19/06 05:43:27 changed by coffee2code

  • status changed from closed to reopened.
  • resolution deleted.

I believe Ulysses inadverently closed this instead of #4002.

03/19/06 17:03:04 changed by ulysses

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [3976]) Undo accidental escaping for mail_to; add regression test. Fix incorrect credit in changelog. Closes #4202.

03/20/06 05:36:54 changed by coffee2code

  • status changed from closed to reopened.
  • resolution deleted.

Inadvertently closed again instead of #4002.

08/19/06 02:24:46 changed by tomg@byu.net

  • keywords set to dragdrop.

This may be resolved by recent commit from #5017. Can someone test and verify?

Is there a time when scrollingParent (as proposed by this patch) would not equal the element in options.scroll?

08/08/07 14:09:26 changed by madrobby

  • status changed from reopened to closed.
  • resolution set to invalid.

Closing idle ticket. If this is still an issue please reopen with an updated patch.