W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2013

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

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 13 Aug 2013 19:56:28 +0000 (UTC)
To: Daniel Trebbien <dtrebbien@gmail.com>
Message-ID: <alpine.DEB.2.00.1308131950570.27623@ps20323.dreamhostps.com>
Cc: whatwg@whatwg.org
On Tue, 13 Aug 2013, Daniel Trebbien wrote:
> Reading through the spec, I am not seeing how an application can 
> determine whether a drop into a different window was successful.

This was an error in the spec. Good catch.

I've updated the spec. The trick is to check event.dataTransfer.dropEffect 
in the dragend event; if it's "none" then the drag was canceled.

This works already in Chrome and Firefox for same-page drags; it also 
works in Chrome for cross-app drags, but in Firefox for some reason you 
always get "none" for cross-app drags currently. It does work for 
cross-page (all within Firefox) drags in Firefox. (Tested on Mac.)

> The spec gives an example of removing the dragged element from the 
> display: 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#introduction-8 
> .. but this has the problem that the element is removed regardless of 
> whether the drop was successful, right?

Good point. Fixed. Thanks!

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 13 August 2013 19:56:53 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:23 UTC