bug(drag-drop): drag-drop broken when initialTransform is none
Reproduction
when any cdkDrag item has initial transform: none will not be draggable.
Use sample repo that reproduce this problem at https://github.com/laiseng/bug-angular-cdk-drag-initial-transform-none
Steps to reproduce:
- clone https://github.com/laiseng/bug-angular-cdk-drag-initial-transform-none
yarn install- ng serve
- drag first div box that has no initial transform value
- drag 2nd div box that has style
transform: none
Expected Behavior
2nd div box with initial value transform: none should be draggable
Actual Behavior
failed to drag 2nd div box that has style transform: none
PR https://github.com/angular/components/pull/22431
bug is cause by attempting to preserve existing transform value using string concat at line below in
angular-components\src\cdk\drag-drop\drag-ref.ts line :1239
this._rootElement.style.transform = this._initialTransform ?
transform + ' ' + this._initialTransform : transform;
}
should have check for none and assign empty string for initialTransform value.
CSS transform: none translate(10px, 10px); is invalid value
Environment
-
Angular: "@angular/core": "~11.2.5",
-
CDK/Material: "@angular/cdk": "^11.2.8", "@angular/material": "^11.2.8",
-
Browser(s):
-
Windows 10 Chrome v89.0.4389.114
Will be resolved by https://github.com/angular/components/pull/22431.
Will be resolved by #22431.
#22431 has been close because it failed circle ci gate keeper. I've created a new cleaner PR to fix this at #22458
Closing since the PR was merged.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.