Ticket #7084 (closed bug: worksforme)

Opened 3 years ago

Last modified 17 months ago

Draggable with parent containment and margin

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

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

comment:1 Changed 3 years ago by Guillaume Gautreau

  • Status changed from new to closed
  • Resolution set to fixed

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 3 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 3 years ago by scott.gonzalez

  • Milestone changed from 1.9 to 1.8.11

comment:4 Changed 3 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 3 years ago by rdworth

  • Status changed from closed to reopened
  • Resolution fixed deleted
  • Milestone 1.8.11 deleted

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 3 years ago by rdworth (previous) (diff)

comment:7 Changed 3 years ago by rdworth

Fix in  http://blog.jquery.com/2011/03/24/jquery-1-5-2-rc-1-released/ Test page at  http://jsfiddle.net/rdworth/5a2BZ/1/ We'll close this ticket once 1.5.2 is final.

comment:8 Changed 3 years ago by Vizor

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

comment:9 Changed 18 months ago by mikesherov

  • Status changed from reopened to open

comment:10 Changed 17 months ago by mikesherov

  • Status changed from open to closed
  • Resolution set to worksforme

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.