W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2010

[whatwg] More questions about the DnD API

From: Daniel Cheng <dcheng@google.com>
Date: Tue, 30 Mar 2010 02:33:07 -0700
Message-ID: <cdc844f71003300233t1fefe6d7sd629cf7488ea0617@mail.gmail.com>
On Tue, Mar 30, 2010 at 1:58 AM, Stef Epardaud <stef at epardaud.fr> wrote:

> On Tue, Mar 30, 2010 at 01:50:45AM -0700, Daniel Cheng wrote:
> >      I want to do more than most file managers and let users visit
> >      subdirectories by pressing control while over them, so they can
> continue
> >      the drag operation inside the directory (and go deeper potentially).
> >      A separate event makes it much easier to detect the key press.
>
> But what was the rationale for preventing key events while doing DnD?
>

I'm not 100% sure, but I'm assume it's so that the process of dragging and
dropping doesn't trigger unrelated mouse / keyboard listeners.


>
> >      No I mean, when an external application initiates a drag and then
> enters
> >      my browser window/document to look for potential places where it
> could
> >      drop it. I want to detect that and highlight all drop targets in the
> >      page. I would do this in the "drag" or "dragstart" events if this
> was
> >      started in the document, but how to do it when it is started by an
> >      external application?
> >
> >    I'd probably use a dragenter listener on the body of the document.
>
> I couldn't get that to work properly with FF 3.6 and gave up after a few
> crashes and hangs (which admitedly are not the spec's fault).


This is probably just an artifact of an incomplete implementation. I don't
think any released browser has implemented 100% of the DnD interfaces yet.
I've also  noticed that some browsers hang if you use alert() during a DnD
event.


>
> Why not make the implied drag and/or dragstart explicitely fired when
> external applications start DnD in the browser? That might make it
> simpler and more consistent.
>

Because those events are intended for a source node. It introduces several
new problems (which node should get the event? how do authors differentiate
between the two different types of dragstart?) without really solving
anything that isn't already handled by other events. If you have drop
targets in your page, you don't really care about a drag and drop operation
in progress unless the item is dragged over your page--at which point one
can simply use dragenter / dragover / dragleave.


> --
> St?phane Epardaud
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100330/8ca1ae76/attachment-0001.htm>
Received on Tuesday, 30 March 2010 02:33:07 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:22 UTC