-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
bug(drag-drop): cdkDropListSortingDisabled interacts badly with connected lists #23766
Comments
The logic of where to place the item when sorting is disabled is:
We have the |
Thanks for looking at this. I updated my example code to try to use First, the predicate is being called with Second, it doesn't seem to work all the time. Take a look at the updated example. The top list's predicate returns true only for |
Regarding the first question, unfortunately we don't have access to the origin context so it's difficult to solve on our end. You should be able to fix it by defining the predicate as an arrow function: Regarding the second question, it's not something I was thinking about when I added the predicate so it could be a bug. Also you might want to check out the Also one more note: you don't really need to disable sorting if you're using the predicate input. |
OK, so, if the sort predicate is able to force an item to be inserted at the end, only, at least that would be consistent, but we still have no control over where the item is inserted, because we don't have a say in where it winds up when the predicate returns false. I agree that at least fixing the bug so it can't be inserted at the beginning would be an improvement. It would be nice to have, if I could tell it where a "sort rejected" item will enter the list. |
Reproduction
This is a fork of the "disable sorting" example from the docs.
https://stackblitz.com/edit/angular-lcgpvd?file=src/app/cdk-drag-drop-disabled-sorting-example.ts
Steps to reproduce:
Expected Behavior
One of the following, internally-consistent behaviors:
Actual Behavior
The incoming item gets a placeholder wherever the user drags it, but then can't be moved. The user can continue dragging back to the original list, so the placeholder goes back to the original position then drag over the target list again to put the placeholder in a new position -- but again, can't move the placeholder directly.
Environment
Comments
I'd like to see the first behavior implemented -- let me supply a sort-function that gets the dragged item's
data
(and maybe the index in its current container?) as an input and outputs the list index at which the placeholder should be inserted. Failing that, I'd at least like a property that lets me say that, since sorting is disabled, the placeholder should go at the "start" or "end".The text was updated successfully, but these errors were encountered: