You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(@angular/cdk/drag-drop): Grabbing a cdkDrag element with underlying link element cause the link to be grabbed with css transition #24403
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 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 on transform 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.
It looks like the issue can also appears sometimes without having to drop and redrag the same item immediately.
Removing the css transition also seems to fix it
There is a workaround : Simply add draggable="false" to the element to prevent the link from being dragged.
However, the cdk dragging still do not trigger when it happens.
Setting user-select: none do not fix it.
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?
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 pointer-events: none on the placeholder fixed it for me. The only other cause I can see is that by default we have some logic which makes it so that you have to drag at least 5px before dragging starts so that dragging isn't mistaken for clicking. You can try to reduce it by adding the following to the component:
Ok so it looks like the issue happens when you mousedown the link on the .cdk-drag-preview while it is still moving, wait for the transition to end, and then start moving the mouse.
The yellow dot tells when I hold left click
That's why you might missed it with 2500ms
Edit: The css you send earlier doesn't fix it unfortunately
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 (dragstart)="$event.preventDefault()" to the cdkDrag elements.
Activity
Raphyyy commentedon Feb 13, 2022
It looks like the issue can also appears sometimes without having to drop and redrag the same item immediately.
Removing the css
transitionalso seems to fix itRaphyyy commentedon Feb 13, 2022
There is a workaround : Simply add
draggable="false"to the element to prevent the link from being dragged.However, the cdk dragging still do not trigger when it happens.
Setting
user-select: nonedo not fix it.fix(cdk/drag-drop): stop pointer events on placeholder
crisbeto commentedon Feb 13, 2022
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?
Raphyyy commentedon Feb 13, 2022
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

Adding this doesn't fix it neither :
I kept the same 250ms transition. Did you try to quickly regrab the item before the transition end ?
crisbeto commentedon Feb 13, 2022
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
pointer-events: noneon the placeholder fixed it for me. The only other cause I can see is that by default we have some logic which makes it so that you have to drag at least 5px before dragging starts so that dragging isn't mistaken for clicking. You can try to reduce it by adding the following to the component:Raphyyy commentedon Feb 13, 2022
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)
crisbeto commentedon Feb 13, 2022
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:
This is what we set on other elements in order to prevent native dragging interactions.
Raphyyy commentedon Feb 14, 2022
Ok so it looks like the issue happens when you mousedown the link on the .cdk-drag-preview while it is still moving, wait for the transition to end, and then start moving the mouse.

The yellow dot tells when I hold left click
That's why you might missed it with 2500ms
Edit: The css you send earlier doesn't fix it unfortunately
fix(cdk/drag-drop): stop pointer events on placeholder
crisbeto commentedon Feb 14, 2022
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
(dragstart)="$event.preventDefault()"to thecdkDragelements.fix(cdk/drag-drop): stop pointer events on placeholder
Raphyyy commentedon Feb 14, 2022
Nice thanks @crisbeto, works great on my side
fix(cdk/drag-drop): stop pointer events on placeholder (#24404)
fix(cdk/drag-drop): stop pointer events on placeholder (#24404)
angular-automatic-lock-bot commentedon Mar 20, 2022
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.
fix(cdk/drag-drop): stop pointer events on placeholder (angular#24404)