Skip to main content

Search and Top Navigation

#10660 closed bug (duplicate)

Opened October 15, 2014 01:29PM UTC

Closed October 15, 2014 02:06PM UTC

Last modified August 16, 2017 07:50PM UTC

Draggable containment area is calculated on start and never updated

Reported by: Novac Owned by:
Priority: minor Milestone: none
Component: ui.draggable Version: 1.10.4
Keywords: Cc:
Blocked by: Blocking:
Description

When you set containment on a draggable object, the containment area is set on drag start and is not updated if new elements are added.

The error occurs if you do the following:

  • Set containment option
  • On drag start, insert element into containment area, e.g. a row
  • Try to drag the draggable element into the new row (still located within the containment area, but added after drag start)

I have created a JSFiddle to show the problem. However, this is the first time using JSFiddle and I couldn't find JQuery UI in the version I was using, but it does illustrate the problem.

http://jsfiddle.net/mLc0bnbL/3/

I suggest one of the following:

  • Update containment area in the drag event (Could see this being a performance hit)
  • Set the containment area after the start event has been triggered.
  • Provide a method to run _setContainment manually
Attachments (0)
Change History (2)

Changed October 15, 2014 02:06PM UTC by scottgonzalez comment:1

resolution: → duplicate
status: newclosed

Duplicate of #4911.This will be addressed in the rewrite with the refresh() method.

Changed August 16, 2017 07:50PM UTC by robsdedude comment:2

This might do the trick inside the event handler

$(this).data('uiDraggable')._cacheHelperProportions();
$(this).data('uiDraggable')._setContainment();