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

function as group.put not working with nested sortables #1434

Closed
nilmerg opened this issue Jan 24, 2019 · 4 comments
Closed

function as group.put not working with nested sortables #1434

nilmerg opened this issue Jan 24, 2019 · 4 comments

Comments

@nilmerg
Copy link

nilmerg commented Jan 24, 2019

Problem:

A function bound to group.put returns false but the drop is still rendered and accepted for nested sortables. For non-nested sortables this works fine.

JSBin/JSFiddle demonstrating the problem:

https://jsbin.com/mucilolido/edit?html,css,js,output

Environment

Broken Sortable.js Version: 1.8.0
Working Sortable.js Version: 1.8.0-rc1

@nilmerg
Copy link
Author

nilmerg commented Jan 24, 2019

Currently digging into this because it blocks me.

It's due to putSortable now being the Sortable (the nested one) while hovering over it with the item.
With 1.8.0-rc1 it's its immediate parent Sortable hence the condition is false and checkPut is being called. With 1.8.0 it's not.

Currently I have no idea why nor how to solve this. Maybe a side-effect of one the fixes? (Can't tell if, as your commit history is not really helpful in this regard.)

@nilmerg
Copy link
Author

nilmerg commented Jan 24, 2019

Well, as far as I can tell it's indeed a problem with how putSortable is now handled. The only thing I'm really sure of is that with 1.8.0-rc1 putSortable was never set to the Sortable for which my function bound to group.put returned false.

Though, even by putting the block which defines putSortable where it previously has been the issue persists. So I'm either on a totally wrong track or something else is going on here as well. Maybe someone with more knowledge of the code is able to pin-point the issue..

@owen-m1
Copy link
Member

owen-m1 commented Jan 24, 2019

@nilmerg Indeed it works in 1.8.0-rc1, but only because bubbling is blocked, which is sub-optimal.

Problem was that target was being set to the li item in the nested sortable, but within the context of the yep sortable, so it thought it was OK to insert after the nested li.

Try master.

Use this link: https://raw.githack.com/SortableJS/Sortable/master/Sortable.js

@nilmerg
Copy link
Author

nilmerg commented Jan 25, 2019

Yes, works like a charm. Thanks a bunch!

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

No branches or pull requests

2 participants