bug(CdkDrag): Drag preview doesn't work well with sticky elements and scrolling
- 主要语言
- 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
if the `cdkDrag` directive is applied on an element inside a container with `position: sticky`, scrolling will reposition the drag preview element. this is especially undesired for configurations such as `[cdkDropListLockAxis]="'x'"` and `[cdkDropListOrientation]="'horizontal'"`
### Reproduction
https://stackblitz.com/edit/components-issue-rtfk83?file=src/app/example-component.html
Steps to reproduce:
1. hold mouse down on element that contains "foo"
2. drag a little bit, then scroll vertically while holding the drag
3. should see the drag preview reposition even though "lock axis" is configured
### Expected Behavior
should not reposition vertically
### Actual Behavior
repositions vertically
### Environment
- Angular: 13.3.0
- CDK/Material: 13.3.0
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS
贡献指南
调研方向
从链接的 StackBlitz 复现开始,检查被拖动元素位于 sticky container 内时的 CDK drag preview 行为。在配置了 lock axis 和 horizontal orientation 的情况下,复现滚动时的垂直重新定位。完成标准是:拖动期间 preview 在垂直方向保持固定,同时现有的水平方向行为保持不变。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100