Opened 9 years ago

Closed 6 years ago

Last modified 6 years ago

#5009 closed bug (fixed)

Draggable: scroll not working with parent's position fixed

Reported by: tyron Owned by:
Priority: major Milestone: 1.10.3
Component: ui.draggable Version: 1.7.2
Keywords: scroll fixed position Cc:
Blocked by: Blocking:

Description

If you create a draggable element inside an fixed positioned element and you drag it all the way down the screen, the element begins to distance from the mouse while the window scrolls.

You can recreate this steps following the steps.

  1. Access the URL http://jqueryui.com/demos/draggable/constrain-movement.html, which is the first example of Draggable - in a new window.
  2. Execute the code below in your address's bar:
    javascript:(function(){$("#draggable").css('top', '4000px');$("#draggable5").parent().css('position','fixed');$("#draggable5").draggable('option','containment', 'html');})();
    
  3. Now, drag the "I'm contained within my parent." box down, and you'll see the results.

If you don't want to use javascript to do the above, you should:

  1. Move the draggable1 (which says "I can be dragged only vertically.") down the screen until there's much vertical scrollbar.
  2. Add to the "#draggable5"'s outer div the rule: "position: fixed;".
  3. Make the "#draggable5"'s containment the html page.

This happens in the stable version 1.7.2 and the SVN's 1.8a1.

Change History (11)

comment:1 Changed 9 years ago by Scott González

Milestone: TBD1.next
Version: 1.8a11.7.2

comment:2 Changed 8 years ago by Scott González

Priority: criticalmajor

comment:3 Changed 6 years ago by Scott González

Milestone: 1.next2.0.0

comment:4 Changed 6 years ago by mikesherov

Status: newopen

comment:5 Changed 6 years ago by mikesherov

Summary: Draggable scroll not working with parent's position fixedDraggable: scroll not working with parent's position fixed

comment:6 Changed 6 years ago by tj.vantoll

#7581 is a duplicate of this ticket.

comment:7 Changed 6 years ago by tj.vantoll

Reduced test case against master http://jsfiddle.net/tj_vantoll/2hAuY/.

comment:8 Changed 6 years ago by Mike Sherov

Resolution: fixed
Status: openclosed

Draggable: Don't cache parent offset if the parent position is fixed. Fixes #5009 - Draggable: scroll not working with parent's position fixed

Changeset: 49c7b7200ef944ffc93487e79e763dfe97b4ff4a

comment:9 Changed 6 years ago by mikesherov

Milestone: 2.0.01.11.0

comment:10 Changed 6 years ago by Mike Sherov

Draggable: Don't cache parent offset if the parent position is fixed. Fixes #5009 - Draggable: scroll not working with parent's position fixed(cherry picked from commit 49c7b7200ef944ffc93487e79e763dfe97b4ff4a)

Changeset: c1011b5b9dbdf59acff2fc26b832e0fba09346bd

comment:11 Changed 6 years ago by Scott González

Milestone: 1.11.01.10.3
Note: See TracTickets for help on using tickets.