angular / angular/components

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

Ouverte
#29,867 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
area: cdk/drag-drop needs: discussion
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la reproduction StackBlitz liée dans src/main.ts et comparez le comportement documenté de pointerPosition dans CdkDragMove avec le résultat lorsque cdkDragBoundary est présent. Suivez la gestion du glissement de CDK qui produit l’événement, puis vérifiez que pointerPosition reste la position à l’écran du curseur en dehors de la limite, tandis que l’élément déplacé reste contraint.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.