[FEATURE] onDragOver
See original GitHub issue2. Describe the bug
onDragOver
of an element is not fired when a motion.div
is dragged over the element. This works for native elements.
Repro: https://codesandbox.io/s/nostalgic-mendel-xmijk?file=/src/App.js:944-976
Bigger context: Implementing a drag and drop with framer-motion
4. Steps to reproduce
Steps to reproduce the behavior:
- Drag the motion.div (blue) over “bucket” - nothing happens
- Drag the div without motion (grey) over “bucket” - fires onDragOver
5. Expected behavior
Both should fire onDragOver events.
7. Environment details
Chrome Version 80 on Mac OS Mojave 10.14.6
Issue Analytics
- State:
- Created 3 years ago
- Reactions:12
- Comments:16
Top Results From Across the Web
HTML ondragover Event Attribute - W3Schools
The ondragover attribute fires when a draggable element or text selection is being dragged over a valid ... Drag and drop is a...
Read more >HTMLElement: dragover event - Web APIs | MDN
The dragover event is fired when an element or text selection is being dragged over a valid drop target (every few hundred milliseconds)....
Read more >HTML | DOM ondragover Event - GeeksforGeeks
The HTML DOM ondragover event occurs when a draggable element is being dragged over a valid ... object.ondragover = function(){myScript};.
Read more >ondragover Event - W3Schools Online Web Tutorials
Drag and drop is a very common feature in HTML5. It is when you "grab" an object and drag it to a different...
Read more >ondragover event - W3big
preventDefault () method to achieve ondragover event. HTML5 Drag and Drop is a very common feature. For more information see our HTML tutorial...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Meanwhile a workaround I use:
pointer-events: none
of the drag elementmouseenter
andmouseleave
will now fire, which enables you the possibility 😁 Hope this helpsThis would be really helpful for complex reordering–presumably we could render some elements as drag targets with
onDragEnter
instead of manually checking for position overlap (which works great for 1D reordering).I’m interested in writing a PR for this, but it would be good to get some conversation going about how this would work.
It seems that native
ondragenter
is fired when the mouse pointer enters the element’s bounding rect, which isn’t ideal. It feels much nicer to fire drag enter events on “is the dragged element’s center within the target bounds?”. This is what theReorder
component does. Do we want to enforce that behavior, even if it differs from the native equivalent?Are simultaneous drag events on different elements supported? I’m not super clued in to touch gestures.