angular / angular/components

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

Aperta
#28,919 4 commenti 2 reazioni 0 assegnatari Vedi su GitHub
area: cdk/drag-drop P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia eseguendo la riproduzione StackBlitz collegata e osserva il comportamento di cdkDropList, cdkPlaceHolder e cdkDrag mentre sposti un elemento dall’elenco di destra a un elenco di sinistra e viceversa. Confronta l’indice del segnaposto restituito e l’indice finale dell’elemento con la posizione originale; il lavoro è completato quando l’elemento e il segnaposto tornano al loro indice originale senza cambiare la direzione del trascinamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.