angular / angular/components

bug(cdkDropList): Wrong index for cdkPlaceHolder/cdkDrag after drag/hover other list and going back to original droplist

Đang mở
#28,919 4 bình luận 2 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

My apologies if this is a stupid use case, I am trying to use multiple droplists as a base for a patience/solitaire card game as a learning project. There are multiple connected droplists where you can only drag the last item, and drop it in the last position of another container. This works amazing.

However, dragging from a cdkDroplist from the right to another cdkDroplist to the left of it and returning to the original list does not put the cdkPlaceHolder in the original index. Dragging from left to right (and returning to the original list) does?!

Not sure is this is an issue or working as intended.
I think i understand partially why it happens, but don't understand why it does work from left to right.

### Reproduction

StackBlitz link: https://stackblitz.com/~/github.com/PsychoSpike/cdkDropListsSortedToBottom
Steps to reproduce:
1. Pick up an item from the most right list
2. Drag(not drop) it over a list to the left
3. Return to the original list

### Expected Behavior

The CdkDragPlaceholder and CdkDrag element returns to its original index

### Actual Behavior

The CdkDragPlaceholder shows up at the wrong index and the CdkDrag element gets put into index-1 from starting the drag

### Environment

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

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

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

Hướng nghiên cứu

Bắt đầu bằng cách chạy bản tái hiện StackBlitz được liên kết và theo dõi hành vi của cdkDropList, cdkPlaceHolder và cdkDrag khi di chuyển một mục từ danh sách bên phải sang danh sách bên trái rồi quay lại. So sánh chỉ mục placeholder được trả về và chỉ mục cuối cùng của mục với vị trí ban đầu; được xem là hoàn tất khi mục và placeholder quay lại chỉ mục ban đầu mà không thay đổi hướng kéo.

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ó
4/5
Thời gian dự kiến
3-5 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
35/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.