angular / angular/components

bug(drag-drop): Item not always restored to initial index when using cdkDropListSortingDisabled on connected lists

Offen
#26,360 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: cdk/drag-drop P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

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

Dragging an item from its original drop list to another one then dragging it back to the original drop list isn't always restored to its initial index.

### Reproduction

StackBlitz: https://stackblitz.com/edit/angular-1ra8a1?file=src/app/cdk-drag-drop-disabled-sorting-example.html

Steps to reproduce:
1. Drag any item item from the top container to the bottom one (without dropping) and drag it back to the top container
2. Observer that the item gets re-added at its original index in the top container
3. Drag any item but the first from the bottom container to the top one (without dropping) and drag it back to the bottom container

### Expected Behavior

Item re-added to the bottom container at its original index.

### Actual Behavior

Item re-added to the bottom container at an index lower than its original.

### Environment

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der Reproduktion im verknüpften StackBlitz, insbesondere in src/app/cdk-drag-drop-disabled-sorting-example.html, und überprüfe, ob sich der Index ändert, wenn Elemente zwischen verbundenen Listen verschoben werden, ohne sie abzulegen. Verfolge die CDK drag-drop-Behandlung für deaktivierte Sortierung und bestätige den Abschluss, wenn ein Element an seine ursprüngliche Liste an seinem ursprünglichen Index zurückkehrt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.