angular / angular/components

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

Offen
#25,283 4 Kommentare 1 Reaktion 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

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der verknüpften StackBlitz-Reproduktion und untersuche das Verhalten der CDK drag preview, wenn sich das gezogene Element innerhalb eines sticky containers befindet. Reproduziere die vertikale Neupositionierung beim Scrollen mit konfiguriertem lock axis und horizontal orientation. Erledigt ist die Aufgabe, wenn die preview während des Drags vertikal fixiert bleibt und das bestehende horizontale Verhalten weiterhin intakt ist.

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
42/100

Neue Issues direkt in Ihr Postfach

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