[whatwg] How to tell when a drag and drop was successful?

Daniel Trebbien dtrebbien at gmail.com
Tue Aug 13 09:26:54 PDT 2013

Reading through the spec, I am not seeing how an application can determine whether a drop into a different window was successful.

Example use case:  An app wants to take advantage of multiple screens, and so it opens two different windows which can be placed on different screens.  The user can "move" items/tasks/events/objects/etc. from one window to another by dragging and dropping an item.  The app sets effectAllowed to "move" in the source window and the dropEffect to "move" in the destination window on dragging over the area where the item is supposed to be dropped.  The drag data are the essential details of the item that allow the destination window to know what was moved.  The source window needs to know whether the drop was successful in order to decide whether to remove the item from the display in the source window.

I have been experimenting with the attached HTML page in Chrome 28.0.1500.95 and Firefox 23.0 on Mac.  I see no difference between the 'dragend' event object of a successful versus non-successful drop.

The spec gives an example of removing the dragged element from the display:
.. but this has the problem that the element is removed regardless of whether the drop was successful, right?

One approach to removing the dragged element (as demonstrated by http://html5demos.com/drag ) is to do the cleanup on 'drop', but in a cross-window dragging scenario, the source window does not receive a 'drop' event.


More information about the whatwg mailing list