Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi sort element going to second position then quickly switching to first? (GIF included) #592

Closed
taylorotwell opened this issue Oct 6, 2015 · 9 comments

Comments

@taylorotwell
Copy link

I have a basic "trello" style multi-sort situation. As you can see in the GIF when I drag an element from one column to the beginning of another column. The animation shows it going to the second position then quickly switching to the first position. Has anyone else seen this behavior and know what causes it?

http://d.pr/i/Fx6y/5spKxMG4

@taylorotwell
Copy link
Author

Fiddle here: https://jsfiddle.net/vw0fawp5/1/

@adamwathan
Copy link

Does it on the homepage examples as well:

2015-10-08 13_39_51

@silentworks
Copy link

The List B to List A example seem to work flawlessly, not sure why the advanced groups is doing that.

@taylorotwell
Copy link
Author

Yeah I noticed the photo example does seem to work pretty well.

@Bramjetten
Copy link

I have the same issue in my implementation. Sometimes it even manages to loop:

sortable

@beckend
Copy link

beckend commented Dec 10, 2015

I worked around it, in Sortable.js 1.4.2:
in _onDragOver method:
line 657:

if (moveVector !== false) {
    _silent = true;
    var ms = this.options.animation;
    if (typeof ms==='number' && (ms%1)===0) {
        ms = (ms + 10);
    }
    else {
        ms = 30;
    }
    setTimeout(_unsilent, ms);

@Bramjetten
Copy link

Seems to work for me!

@beckend
Copy link

beckend commented Dec 10, 2015

I figured it out, in my case, I have some random display none elements in my sortable container, which I actually use.
This workaround works, but it's a hack.
I had to remove all my custom element which are not part of the sortable. Then trigger a reinit sortable.
Basically Sortable.js uses nextElementSibling, previousElementSibling, and expects them to be sortable elements, not random elements.

If Sortable.js added classes to the sortablejs and use getElementsByTagName internally this would work correctly?
I guess that also means options.handle would have some default class.

@owen-m1
Copy link
Member

owen-m1 commented Dec 15, 2018

Solved in 1.8.0-rc1

Before:

before

After:

after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants