Closed Bug 631713 Opened 13 years ago Closed 8 years ago

Child elements cause dragenter & dragleave order to be reversed

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 619703

People

(Reporter: a, Unassigned)

Details

Attachments

(1 file)

If you have following code:
<div>
<p>drop file here</p>
</div>

and you drag a file without droping in this sequence 
desktop -> div -> paragraph -> div -> desktop

dragenter[object HTMLDivElement]
dragenter[object HTMLParagraphElement] # bug, we are entering paragraph before leaving div
dragleave[object HTMLDivElement] # bug, we leave div after entering paragraph
dragenter[object HTMLDivElement] 
dragleave[object HTMLParagraphElement] # same bug here, we enter div before leaving paragraph
dragleave[object HTMLDivElement]

On almost every platform I've worked on, drag'n'drop events are messed up in minor ways like this, it'd be nice if you guys fixed it. Attached is a simple page that demonstrates the bug.
This is not a bug; it's in the spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag-and-drop-processing-model

In the second list of steps (the ones repeated regularly), step 3 fires the dragenter, and then step 4 fires the dragleave.
See also https://bugzilla.mozilla.org/show_bug.cgi?id=619703, I think this is a duplicate. (This ordering can actually make it easier to deal with leave events triggered on a parent when the mouse enters a child — [enter (parent), enter (child), leave (parent)] can be detected as mouse still in parent whereas [enter (parent), leave (parent), enter (child)] could cause mayhem especially if the child element is removed when the drag leaves the parent.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: