Opened 23 months ago

Last modified 23 months ago

#12573 open bug

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: http://i.stack.imgur.com/cgPRH.gif

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

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

Change History (4)

comment:1 follow-up: Changed 23 months ago by scottgonzalez

  • Owner set to crash1912
  • Status changed from new to pending

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?

comment:2 in reply to: ↑ 1 Changed 23 months ago by crash1912

  • Status changed from pending to new

Replying to 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:

http://i.imgur.com/LJuFxtV.gif

mouse loses element!

comment:3 follow-up: Changed 23 months ago by scottgonzalez

  • Status changed from new to open
  • Summary changed from jQuery UI Issue when use Draggable items connected to Sortable list AND Containment is defined to Draggable: 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/

comment:4 in reply to: ↑ 3 Changed 23 months ago by crash1912

Replying to 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...

Note: See TracTickets for help on using tickets.