angular / angular/components

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

オープン
#28,919 コメント 4 件 リアクション 2 件 担当者 0 名 GitHub で見る
area: cdk/drag-drop P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
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

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):

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、リンクされた StackBlitz の再現手順を実行し、右側のリストから左側のリストへ、また元に戻すように項目を移動しながら、cdkDropList、cdkPlaceHolder、cdkDrag の動作を確認します。返されたプレースホルダーのインデックスと最終的な項目のインデックスを元の位置と比較します。ドラッグ方向を変更せずに、項目とプレースホルダーが元のインデックスに戻れば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。