Opened 12 years ago

Closed 11 years ago

#7084 closed bug (worksforme)

Draggable with parent containment and margin

Reported by: ghusse Owned by:
Priority: minor Milestone:
Component: ui.draggable Version: 1.8.10
Keywords: Cc:
Blocked by: Blocking:

Description

On jQuery UI 1.8.10

With 2 div elements, the parent has a fixed width (600px), the child element with a smaller width value. Both parent and child have the same height.

The child element has a left and right margin of about 5px, and is made draggable with the following options:

 {
  axis:"x",
  containment: "parent"
 }

When I dragg the child element on left or right, at the very end, child's magin is ignored on dragging. But once the element is dropped, it is moved according to the margin.

Change History (10)

comment:1 Changed 12 years ago by Guillaume Gautreau

Resolution: fixed
Status: newclosed

Draggable: modify margins of the containment according to the margin of the draggable element. Fixed #7084 - Draggable with parent containment and margin

Changeset: 3a0ec399cdd19c7e7b11934aef559cfa6b8f8258

comment:2 Changed 12 years ago by Guillaume Gautreau

Draggable: modify margins of the containment according to the margin of the draggable element. Fixed #7084 - Draggable with parent containment and margin (cherry picked from commit 3a0ec399cdd19c7e7b11934aef559cfa6b8f8258)

Changeset: a067dfa8a22f9705bd062cfd651feb0bff3e3cf6

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

Milestone: 1.91.8.11

comment:4 Changed 12 years ago by mofle

This brings a regression in Webkit, that prevents me from dragging: http://jsfiddle.net/mofle/kMgB3/

Works in Firefox, but not Webkit.

1.8.10 worked in both.

comment:5 Changed 12 years ago by rdworth

Milestone: 1.8.11
Resolution: fixed
Status: closedreopened

This is caused by https://bugs.webkit.org/show_bug.cgi?id=13343 which is now fixed (chromium and webkit nightlies since late Feb 2011) but of course the issue is still present in many supported WebKit browsers.

There's a workaround listed on the chromium bug http://code.google.com/p/chromium/issues/detail?id=23816 but it involves appending the element to an element with display:absolute. That seems a bit much.

I found a feasible workaround by setting display: inline-block on the element. That could be done temporarily just to get the correct computed marginRight value even. May need to raise with jQuery core dev team as this is really a .css() issue not a draggable issue, but reopening until it's resolved or worked around.

Last edited 12 years ago by rdworth (previous) (diff)

comment:7 Changed 12 years ago by rdworth

comment:8 Changed 12 years ago by Vizor

On document or window as containment the problem persists. example: http://jsfiddle.net/5FJpm/2/

comment:9 Changed 11 years ago by mikesherov

Status: reopenedopen

comment:10 Changed 11 years ago by mikesherov

Resolution: worksforme
Status: openclosed

Thanks for taking the time to contribute to the jQuery UI project! I can no longer reproduce the issue using the latest jQuery and jQuery UI using the info provided. http://jsfiddle.net/dVeeh/

If you can still reproduce it, please feel free to reply to this ticket with a test case showing the problem. Thanks!

Note: See TracTickets for help on using tickets.