Skip to content

bug(CdkDrag): Set free drag position doesn't take scale into consideration on first drag event #29737

Closed
@raducostea

Description

@raducostea

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

When using a parent scaled component and cdkDragFreeDragPosition with cdkDragScale, on first drag the element jumps and then the draging works correctly.

Reproduction here
https://stackblitz.com/edit/stackblitz-starters-9kq1ej?file=src%2Fmain.ts

My guess is that passive transform in drag ref does not update to take scale into consideration
https://github.com/angular/components/blob/main/src/cdk/drag-drop/drag-ref.ts#L594

Reproduction

StackBlitz link:
https://stackblitz.com/edit/stackblitz-starters-9kq1ej?file=src%2Fmain.ts

Steps to reproduce:

  1. Add scale transform to parent component
  2. Add cdkDrag, cdkDragFreeDragPosition (required) and cdkDragScale to draggable element

Expected Behavior

On drag when using scale, the element should not jump

Actual Behavior

When using a parent scaled component and cdkDragFreeDragPosition with cdkDragScale, on first drag the element jumps and then the draging works correctly.

Environment

  • Angular: 18.2
  • CDK/Material: 18.2
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/drag-drop

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions