cdkDropList: event.previousIndex does not update on second move
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
#### Bug, feature request, or proposal:
When you drag and drop a row for the second time, the previousIndex is still the same as the initial value.
#### What is the expected behavior?
previousIndex should reflect the items position when the dragging is started.
#### What is the current behavior?
It stays the same as the initial value, so neither sorting nor moving works as intended. It only works the first time moving the row, after that it will always jump back/move another item.
#### What are the steps to reproduce?
Stackblitz here:
https://stackblitz.com/edit/table-drag-n-drop
#### Is there anything else we should know?
I am using cdkDropList together with Material Table.
Contributor guide
Research direction
Start with the linked StackBlitz reproduction and the cdkDropList event handling used with Material Table. Reproduce two successive moves and inspect whether previousIndex reflects the position at drag start. Done means sorting and moving continue to work correctly on subsequent moves.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100