-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(cdk/drag-drop): last item not returned at initial index when sorting is disabled #23934
fix(cdk/drag-drop): last item not returned at initial index when sorting is disabled #23934
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
src/cdk/drag-drop/drop-list-ref.ts
Outdated
@@ -299,6 +299,16 @@ export class DropListRef<T = any> { | |||
newPositionReference = activeDraggables[newIndex + 1]; | |||
} | |||
|
|||
// If we didn't find a new position reference, it means that either the item didn't start off | |||
// in this container, or that the item request to be inserted at the end of the list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// in this container, or that the item request to be inserted at the end of the list. | |
// in this container, or that the item requested to be inserted at the end of the list. |
…ing is disabled Fixes a regression caused by angular#19116 where dragging the last item into another container and returning it back to the initial one would insert the item into the first index of the list, rather than the last one. The issue was caused by the fact that we relied on the item to always be inserted at the end of the list of there is no position reference, but the condition was superceded by the condition that inserts it at the beginning of the list. Fixes angular#23865.
2d14ac3
to
05f8dfb
Compare
…ing is disabled (#23934) Fixes a regression caused by #19116 where dragging the last item into another container and returning it back to the initial one would insert the item into the first index of the list, rather than the last one. The issue was caused by the fact that we relied on the item to always be inserted at the end of the list of there is no position reference, but the condition was superceded by the condition that inserts it at the beginning of the list. Fixes #23865. (cherry picked from commit e219008)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes a regression caused by #19116 where dragging the last item into another container and returning it back to the initial one would insert the item into the first index of the list, rather than the last one. The issue was caused by the fact that we relied on the item to always be inserted at the end of the list of there is no position reference, but the condition was superseded by the condition that inserts it at the beginning of the list.
Fixes #23865.