[Bug 14638] Should a canceled drop event signify a failed drop operation?

http://www.w3.org/Bugs/Public/show_bug.cgi?id=14638

--- Comment #2 from bytecrafter@gmail.com 2011-11-01 04:36:35 UTC ---
I'm reading the Editor's Draft 30 October 2011 (was at
http://dev.w3.org/html5/spec/Overview.html today, but probably won't be
tomorrow). I'm not validating the spec against any browsers (WebKit in
particular seems to ignore big chunks of it anyway), so this is all in
thought-land.

Some quotes (with extra detail removed):

"If the current drag operation is "none", or if the user ended the
drag-and-drop operation by canceling it, or if the current target element is
null, then the drag operation failed." ... "Otherwise, the drag operation was
as success; run these sub steps:" (including "Let dropped be true." and "fire a
DND event named drop")

Or, it looks like the success is determined before the drop event is fired, and
the success is not changed based upon the cancelation of the drop event. This
is probably just an issue with wording. It seems intuitive that canceling the
drop event would flag the drop as failed; I was surprised when the spec didn't
agree with that intuition. I would move the clause "the drag operation was a
success" (and possible "let dropped be true") to a place later in the workflow.
Here's my suggestion (I hope the formatting comes out legibly):

--------

Otherwise, if the user ended the drag-and-drop operation (e.g. by releasing the
mouse button in a mouse-driven drag-and-drop interface), or if the drag event
was canceled, then this will be the last iteration. Run the following steps,
then stop the drag-and-drop operation:

      1. If the current drag operation is "none" (no drag operation), or, if
the user ended the drag-and-drop operation by canceling it (e.g. by hitting the
Escape key), or if the current target element is null, then run these substeps:

            If the current target element is a DOM element, fire a DND event
named dragleave at it; otherwise, if it is not null, use platform-specific
conventions for drag cancellation.

         Otherwise, run these substeps:

            1. If the current target element is a DOM element, fire a DND event
named drop at it; otherwise, use platform-specific conventions for indicating a
drop.

            2. If the event is canceled, set the current drag operation to the
value of the dropEffect attribute of the DragEvent object's dataTransfer object
as it stood after the event dispatch finished.

               Otherwise, the event is not canceled; perform the event's
default action, which depends on the exact target as follows:
                  ...

      2. If the current drag operation is "none" (no drag operation), then the
drag operation failed. Run these substeps:
            Let dropped be false.
         Otherwise, the drag operation was a success; run these substeps:
            Let dropped be true.

      3. Fire a DND event named dragend at the source node.

      4. Run the appropriate steps from the following list as the default
action of the dragend event:

            ...

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 1 November 2011 04:36:44 UTC