[whatwg] More questions about the DnD API

Daniel Cheng dcheng at google.com
Mon Mar 29 14:04:22 PDT 2010

On Sun, Mar 28, 2010 at 1:29 PM, Stef Epardaud <stef at epardaud.fr> wrote:

> Hello,
> I didn't get any reaction to my previous email unfortunately since I
> think I brought up some valid points, but in any case I have some more
> feedback, so I keep sending :)
> I'm still trying to use the DnD for a real-world use, and keep hitting
> problems. This is the HTML 5 draft at 7.9.4 Drag-and-drop processing
> model:
> "From this point until the end of the drag-and-drop operation, device
> input events (e.g. mouse and keyboard events) must be suppressed."
> This looks crazy to me. First Mozilla doesn't limit this since I was
> able to get a keypress event while dragging a node. I use this to change
> the behaviour of the drag operation with control/meta/alt keys while
> dragging, the same way file managers do it (at least Gnome Nautilus) and
> lots of other applications (Open Office for example). We need to be able
> to access key events while dragging. There might be a good rationale for
> this limitation stated in the spec, but based on evidence of how DnD is
> used in other applications perhaps it should be reviewed?

DragEvent (via MouseEvent) should expose ctrlKey, altKey, metaKey, and
shiftKey properties.

> Personally I also use the key events while dragging to allow the user to
> open folders in order to continue the drag operations inside, instead of
> requiring them to drop the file in the folder, then open the folder and
> drag it again to a subfolder.
> I also have a question regarding DnD started in an external application:
> since we get no dragstarted or drag events, how can we detect that
> something wants to be dragged in the window? I want to highlight every
> responsive drop points so the user can know which elements are valid
> drop targets, but failed to get any meaningful interaction with
> dragentered or dragover on the document, or body elements. Surely that's
> a mistake from my part, but since I expect that it's going to be asked a
> lot (when we don't get drag or dragstart events), perhaps it should be
> mentioned in the spec?

dragstart and drag events are fired at the source node, but since you're
dragging from a non-DOM application, you won't get any. You should still be
getting dragenter / dragover / dragleave / drop if the item is
dragged/dropped over a DOM page though. It works for me in WebKit.

> Thanks for your help.
> --
> Stéphane Epardaud

Of course, I have a question of my own. In
is it intentional that any drag event can change the value of effectAllowed
for the next event? Does it make sense to making this property settable only
during dragstart / drag?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100329/f5835f4b/attachment-0002.htm>

More information about the whatwg mailing list