angular / angular/components

bug(CdkDragDrop): reordering smaller against larger items produce flickering effect

未关闭
#28,266 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area: cdk/drag-drop P4
主要语言
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

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

贡献指南

打开贡献指南

调研方向

首先运行链接的 StackBlitz 复现,并检查 src/app/cdk-drag-drop-horizontal-sorting-example.css、.ts 和 .html。复现将“Iron age”拖过“Early modern period”对面的空白区域,然后跟踪 CdkDragDrop 的水平排序行为。当不同大小的项目能够在不闪烁的情况下重新排序,并且与相同大小项目和较短容器的行为一致时,即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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