angular / angular/components

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

未关闭
#30,239 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
area: cdk/drag-drop P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### 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

贡献指南

打开贡献指南

调研方向

从链接的 StackBlitz 复现开始,检查项目从顶部进入 Done dropzone 时 cdkDropListSortPredicate 的行为。在 Angular 19.0.0 中复现该情况,然后验证 predicate 是否会阻止项目被放置在第一个索引处,同时保留其他排序行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。