bug(CdkDragDrop): reordering smaller against larger items produce flickering effect
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
When using CdkDragDrop for reordering items with different sizes (e.g. width for horizontal orientation) in a container with greater height then of the elements there is a flickering effects. CdkDragDrop moves larger item really quickly from one side to another.
Try to drag "Iron age" over empty space in container against some wider item (e.g. "Early modern period")
Example uses angular 12, but in angular 17 it works the same.
### Reproduction
StackBlitz link: https://stackblitz.com/edit/angular-fhqz1h?file=src%2Fapp%2Fcdk-drag-drop-horizontal-sorting-example.css,src%2Fapp%2Fcdk-drag-drop-horizontal-sorting-example.ts,src%2Fapp%2Fcdk-drag-drop-horizontal-sorting-example.html
### Expected Behavior
Reorder elements without flickering effects, as it is when reordering elements of the same size or when container is not larger (e.g. greater height for horizontal list).
### Actual Behavior
Larger element in the list that is reordered against moves fast from one side to another.
### Environment
- Angular: 12
- CDK/Material: 12
- Browser(s): any
- Operating System (e.g. Windows, macOS, Ubuntu): any
Contributor guide
Research direction
Start by running the linked StackBlitz reproduction and inspect src/app/cdk-drag-drop-horizontal-sorting-example.css, .ts, and .html. Reproduce dragging “Iron age” over empty space against “Early modern period,” then trace the horizontal CdkDragDrop sorting behavior. Done means differently sized items reorder without flickering, matching same-size and shorter-container behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100