-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug(@angular/cdk/drag-drop): Grabbing a cdkDrag element with underlying link element cause the link to be grabbed with css transition #24403
Comments
There is a workaround : Simply add |
Removes the pointer events from the drag placeholder so that the user can't interact with it while the preview is animating. Fixes angular#24403.
I couldn't quite reproduce the issue without slowing down the preview transition a lot, but my theory is that the dragging is actually happening on the placeholder element behind the preview. I have #24404 out to fix it, but can you double-check that adding the following CSS styles resolve the issue for you? .cdk-drag-placeholder {
pointer-events: none;
} |
Thanks @crisbeto, unfortunately this doesn't fix it on my side : https://stackblitz.com/edit/angular-pqknrn-x92xnv?file=src/app/cdk-drag-drop-connected-sorting-group-example.css
I kept the same 250ms transition. Did you try to quickly regrab the item before the transition end ? |
Yes, I can't reproduce it at all with the 250ms transition on either Chrome or Firefox. I could reproduce it if I bump up the transition to 2500ms, but the
|
Added this to component :
Doesn't fix it unfortunately. Tested the issue on another Windows 11 and got the same result (both in a clean environment browser) |
I'm testing on a Windows machine as well so it's weird that it doesn't happen for me. One more thing worth trying is to expand the CSS from above to: .cdk-drag-placeholder {
pointer-events: none;
touch-action: none;
-webkit-user-drag: none;
use-select: none;
} This is what we set on other elements in order to prevent native dragging interactions. |
Removes the pointer events from the drag placeholder so that the user can't interact with it while the preview is animating. Fixes angular#24403.
Thanks, I was able to reproduce it now, albeit not consistently. I've pushed another fix to #24404. You can try it out by adding |
Removes the pointer events from the drag placeholder so that the user can't interact with it while the preview is animating. Fixes angular#24403.
Nice thanks @crisbeto, works great on my side |
Removes the pointer events from the drag placeholder so that the user can't interact with it while the preview is animating. Fixes #24403.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Removes the pointer events from the drag placeholder so that the user can't interact with it while the preview is animating. Fixes angular#24403.
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When grabbing an element that just have been dropped, you will get the underlying link to be grabbed instead of the cdkDrag element if you drag from the link.
It only appears if used CSS
transition
ontransform
to make smoother moves, so I think the issue is happening when the CSS animation has not ended.Attaching cdkDrag to a parent element instead of setting it on the element doesn't change a thing. (see difference between the "To do" cdkDropList and the "Done" cdkDropList.
Maybe related issue : https://stackoverflow.com/questions/68924215/cdkdrag-sometimes-grabs-uderlying-link-element
Note : the attached stackblitz run Angular 12.0.0, but the issue also appears on my local with Angular 13.2.2.
Reproduction
Steps to reproduce:
Expected Behavior
The underlying link should not be dragged
Actual Behavior
The underlying link is dragged instead of the cdkDrag element
Environment
The text was updated successfully, but these errors were encountered: