Opened 10 years ago

Closed 7 years ago

#4741 closed bug (duplicate)

placeholder flickers between nested levels

Reported by: kae Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.sortable Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Description

<ul>

<li>menu 1

<ul>

<li>submenu 1<ul></ul></li> <li>submenu 2<ul></ul></li>

</ul>

</li>

</ul>

if you create a nested sortable from the above (.sortable() on all <ul>s, then connectWith them together), then drag one of teh inner <li> elements around, you will see it flicker between the different levels of nesting.

the reason for this is that there are two separate loops for finding intersecting lists.

  1. _contactContainers: this one is fine - it properly moves an item only into the innermost container
  2. _mouseDrag: in here, there is an algorithm which drags the item nest to to the "nearest" intersecting item, but it ignores what container the placeholder is currently in. this is the problem algorithm. When you comment this out, the flickering stops, but obviously, you also lose functionality.

Change History (12)

comment:1 Changed 10 years ago by kae

this can be solved by only allowing the placeholder to be moved amidst items in the container it is currently in. apparently, this causes problems, though, with some current code.

comment:2 Changed 10 years ago by kae

I mean, within _mouseDrag, don't allow the algorithm to move the placeholder out of its current container. obviously, the _contactContainers needs to be able to do this.

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

Milestone: TBD1.8

comment:4 Changed 9 years ago by Heilemann

Any news on this?

comment:5 Changed 9 years ago by webconia

I have the same problem. This is really annoying, makes it nearly impossible to drag & drop elements from one nested list into a child list.

Is there a plan to fix this bug? Any workarounds known?

comment:6 Changed 9 years ago by gmork

I also have the same problem, using nested sortables. Any workaround would be greatly appreciated.

comment:7 Changed 9 years ago by diffident

Yes, I am seeing this issue as well. Is there a work around right now?

comment:8 Changed 9 years ago by diffident

Uncommenting the following line in version 1.8.9 fixed the issue for me:

// && itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container

I wonder what the downside of uncommenting this is. Anyone know? I'm still able to drag items between the nested sortables (which are connected to each other with the connectWith option).

Last edited 9 years ago by diffident (previous) (diff)

comment:9 Changed 7 years ago by MagmaRules

I'm having the same problem. If i activate the tolerance: "pointer" I end up not being able to drag to "child" sortables at all.

Un-commenting that line allows me to drag from parent sortables to child sortables. However you cannot drag from child sortables to parent sortables.

I found the solution here: https://github.com/jquery/jquery-ui/pull/555

Fixes both problems for me.

comment:10 Changed 7 years ago by MagmaRules

After further testing the patch introduces crazy flickers at the same level in my case. Going to continue to search for a viable solution.

comment:11 Changed 7 years ago by Scott González

Milestone: 1.9.02.0.0

comment:12 Changed 7 years ago by mikesherov

Resolution: duplicate
Status: newclosed

Duplicate of #4857.

Note: See TracTickets for help on using tickets.