Closed Bug 527749 Opened 15 years ago Closed 14 years ago

Drag events out of order


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

Not set



Tracking Status
blocking2.0 --- betaN+


(Reporter: dbates, Assigned: enndeakin)



(Keywords: html5)


(2 files)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/20090824 Firefox/3.5.3
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/20090824 Firefox/3.5.3

The drag-and-drop processing model used in Firefox does not conform to section 7.9.4 of the HTML 5 spec. <>. In particular, the order of dragenter and dragleave events are reversed in Firefox. That is, Firefox fires dragleave then dragenter, but it should be dragenter then dragleave.

This issues is similar to an drag event ordering issue in WebKit bug #30754 <>.

Reproducible: Always
Attached file Test case
Test case derived from a similar WebKit test.
Confirmed on trunk.
Component: General → Drag and Drop
Ever confirmed: true
Keywords: html5
OS: Mac OS X → All
Product: Firefox → Core
QA Contact: general → drag-drop
Hardware: x86 → All
Version: unspecified → Trunk
Probably a quick fix for somebody familiar with the code and an HTML5 compliance win.  Nominating for blocking.
blocking2.0: --- → ?
need a dupeme maybe, But also I think trunk is correct.
oops sorry missed comment 2
Enn, can you take this? (And hopefully get a test into the HTML test suite, if such a thing exists.)
Assignee: nobody → enndeakin
blocking2.0: ? → betaN+
Attached patch PatchSplinter Review
This patch moves the dragleave event to fire after the dragenter event. For developers that want the more sensible event order, including the places in browser, editor and toolbar customization code, the dragexit event still fires before the dragenter event as before.

The event order then is:
  dragexit, dragenter, dragleave

Can't be tested automatically. Works with the testcase.
Attachment #492371 - Flags: review?(Olli.Pettay)
Attachment #492371 - Flags: review?(dao)
Attachment #492371 - Flags: review?(dao) → review+
Whiteboard: [needs review smaug]
This is rather strange. Why should dragenter fire before dragleave?
Is this something that IE does always? I guess I need to test IE.

Could we just change HTML5 draft?
IE always fires dragenter before dragleave. About a year ago, Webkit was changed to this behaviour as well.

Changing our behaviour could have compatibility issues for us which is why I had to change code to use the dragexit event.

Likely though, there would be less of a problem to go from the IE behaviour to our behaviour as I can't see why the unusual event order would be useful and relied on.
Yeah the IE behaviour (and thus the spec) is pretty nutty here.

dropexit seems like a reasonable idea; if you'd like it formalised and specced please feel free to mail the WHATWG list mentioning it.
Attachment #492371 - Flags: review?(Olli.Pettay) → review+
Keywords: checkin-needed
Whiteboard: [needs review smaug]
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
No longer blocks: FF2SM
You need to log in before you can comment on or make changes to this bug.