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

[whatwg] More questions about the DnD API

From: Stef Epardaud <stef@epardaud.fr>
Date: Tue, 30 Mar 2010 11:11:04 +0200
Message-ID: <20100330091103.GA28913@inforealm.org>
On Tue, Mar 30, 2010 at 01:31:15AM -0700, Daniel Cheng wrote:
>      But then it's up to the developer to detect that the keys weren't
>      pressed before (implement keydown events themselves), which is less
>      practical.
> 
>    If you're copying the behavior of file managers, isn't it simply a matter of
>    setting dropEffect to whatever the current state of the modifier keys are?
>    function dragOver(e) {
>    ? ? if (e.ctrlKey) e.dropEffect = 'copy';
>    ? ? else e.dropEffect = 'move';
>    ? ? e.preventDefault();
>    }
>    I'm not sure how having separate keyboard events would help in this case,
>    since you can't set dropEffect directly from a keyboard event.

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 if I want to be notified that an external application started a drag
>      in my document, where should I place the listener then? document? body
>      node?
> 
>    If an external application initiates a drag in your DOM page via the
>    appropriate method for your platform, it should be the same as if a user
>    initiated it. The dragstart event / drag events should end up getting fired
>    at whatever node the application initiated the drag on. Maybe I'm
>    misunderstanding your question though...

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?
-- 
St?phane Epardaud
Received on Tuesday, 30 March 2010 02:11:04 UTC

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