Skip to main content

Search and Top Navigation

#12573 open bug ()

Opened May 12, 2015 04:21PM UTC

Last modified May 13, 2015 09:52AM UTC

Draggable: Incorrect position when using containment and leaving a sortable

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

The problem is the draggable element when I exceeds limit defined in "containment" ... the "helper" in this moment away from the pointer, which is a major hassle ...

The code JS:

$(".sortable").sortable({
  containment: '.demo',
});

$(".draggable").draggable({
  containment: '.demo',
  connectToSortable: '.sortable',
});

HTML:

<div class="demo">
<ul>
  <li class="draggable ui-state-highlight">Arrastrame fuera</li>
</ul>

<ul class="sortable">
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Arrastrame fuera</li>
  <li>Item 4</li>
  <li>Item 5</li>
</ul>
</div>

gif with problem playback:

[[Image(http://i.stack.imgur.com/cgPRH.gif)]]

JSFIDDLE DEMO: https://jsfiddle.net/oooer0hp/4/

Web Browsers affected: ALL, firefox, chrome, safari...

Help please...

Attachments (0)
Change History (4)

Changed May 12, 2015 05:04PM UTC by scottgonzalez comment:1

owner: → crash1912
status: newpending

I don't see any problem; the element *can't* follow the cursor since that's exactly what the containment option *is*. What exactly do you expect to happen?

Changed May 12, 2015 06:21PM UTC by crash1912 comment:2

status: pendingnew

Replying to [comment:1 scott.gonzalez]:

I don't see any problem; the element *can't* follow the cursor since that's exactly what the containment option *is*. What exactly do you expect to happen?

Please, see demo:

[[Image(http://i.imgur.com/LJuFxtV.gif)]]

mouse loses element!

Changed May 12, 2015 11:48PM UTC by scottgonzalez comment:3

status: newopen
summary: jQuery UI Issue when use Draggable items connected to Sortable list AND Containment is definedDraggable: Incorrect position when using containment and leaving a sortable

Ok, so the problem is that when the draggable leaves the sortable and the cursor is outside of the containment, the draggable is forced to a new location which isn't accounted for in the cursor offset. Here's a reduced test case: https://jsfiddle.net/oooer0hp/7/

Changed May 13, 2015 09:52AM UTC by crash1912 comment:4

Replying to [comment:3 scott.gonzalez]:

Ok, so the problem is that when the draggable leaves the sortable and the cursor is outside of the containment, the draggable is forced to a new location which isn't accounted for in the cursor offset. Here's a reduced test case: https://jsfiddle.net/oooer0hp/7/

Doesnt work, problem is same. With "parent" fix the problem, BUT NOT ALWAYS is possible use "parent"... in jquery ui 1.10 this problem not exist, appears in 1.11...

I need solve this problem, please, help...