Ian McNally

dragleave

May 14, 2014

I had an element that was listening for dragenter and dragleave. Turns out dragleave would be fired even if you hadn’t left the element. When a drag reached the boundary of the element’s child, it fired dragleave. To get around that, I applied this CSS to the children:

.child
    pointer-events: none

and voila! No more events fired on the child.

As it turns out, I found this Stack Overflow post after I’d figured it out.


Ian McNally

Hey, I'm Ian. I build websites and write about what I learn as I go. Follow me on Twitter.