angular / angular/components

bug(CdkDrag): Drag preview doesn't work well with sticky elements and scrolling

Đang mở
#25,283 4 bình luận 1 reaction 0 người được giao Xem trên GitHub
area: cdk/drag-drop P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với bản tái hiện StackBlitz được liên kết và kiểm tra hành vi của CDK drag preview khi phần tử được kéo nằm bên trong một sticky container. Tái hiện việc định vị lại theo chiều dọc khi cuộn với lock axis và horizontal orientation được cấu hình. Hoàn tất khi preview vẫn cố định theo chiều dọc trong suốt quá trình drag, đồng thời hành vi theo chiều ngang hiện có vẫn được giữ nguyên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.