angular / angular/components

bug(cdkDrag): "pointerPosition" property of the "CdkDragMove" event is not correct with "cdkDragBoundary"

Offen
#29,867 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: cdk/drag-drop needs: discussion
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

**Context**
According to the official documentation, the property "pointerPosition" of the "CdkDragMove" event is : "Position of the user's pointer on the page."
See : https://material.angular.io/cdk/drag-drop/api#CdkDragMove

**Problem**
If I use the "cdkDragBoundary" property, the property "pointerPosition" returns cursor position only between boundaries.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-knrvcz?file=src%2Fmain.ts
Steps to reproduce:
1. Move the red block until the cursor moves out of the blue block
2. At the bottom of the blue box, you will see that the cursor position is stuck to the boundaries of the blue box.

### Expected Behavior

I expect to have the current position of the cursor on screen, wherever it is located.

### Actual Behavior

The position displayed of the cursor is limited to the limits of the blue block

### Environment

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit der verknüpften StackBlitz-Reproduktion in src/main.ts und vergleiche das dokumentierte Verhalten von CdkDragMove für pointerPosition mit dem Ergebnis, wenn cdkDragBoundary vorhanden ist. Verfolge die CDK-Drag-Verarbeitung, die das Ereignis erzeugt, und überprüfe anschließend, dass pointerPosition außerhalb der Begrenzung die Bildschirmposition des Cursors beibehält, während das gezogene Element eingeschränkt bleibt.

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.