angular / angular/components

bug(drag-drop): cdkDropListSortPredicate doesn't work if dragging item enter from top

Open
#30,239 3 comments 1 reaction 0 assignees View on GitHub
area: cdk/drag-drop P3
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

`cdkDropListSortPredicate` doesn't work in certain senarios

### Reproduction

StackBlitz link: https://stackblitz.com/edit/z6ffpx7e-wg8uidxw?file=src%2Fexample%2Fcdk-drag-drop-connected-sorting-group-example.html
Steps to reproduce:
1. Open StackBlitz reproduction link
2. The code has `cdkDropListSortPredicate` applied to "Done" dropzone, the intention is preventing item being dragged to the first index
3. Drag item from "To do" zone and enter "Done" zone from top

![Image](https://github.com/user-attachments/assets/637185b0-c963-4314-ac5b-6fd9d58d2aa8)

### Expected Behavior

Item cannot be dragged & dropped to the first index in "Done"

### Actual Behavior

Item can be dragged & dropped to the first index in "Done"

### Environment

- Angular: 19.0.0
- CDK/Material: 19.0.0
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and inspect the cdkDropListSortPredicate behavior when an item enters the Done dropzone from the top. Reproduce the case in Angular 19.0.0, then verify that the predicate prevents the item from being dropped at the first index while preserving other sorting behavior.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.