[Webkit-unassigned] [Bug 233555] File DnD event.dataTransfer.items.length is zero in dragenter, over events

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 9 16:46:43 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=233555

alexreardon at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alexreardon at gmail.com

--- Comment #3 from alexreardon at gmail.com ---
>From the spec:

> A drag data store mode, which is one of the following:
> *Read/write mode*
> For the dragstart event. New data can be added to the drag data store.
> *Read-only mode*
> For the drop event. The list of items representing dragged data can be read, including the data. No new data can be added.
> *Protected mode*
> For all other events. The formats and kinds in the drag data store list of items representing dragged data can be enumerated, but the data itself is unavailable and no new data can be added.

https://html.spec.whatwg.org/multipage/dnd.html#the-drag-data-store

During all drag events other than "dragstart" and "drop" the drag data store (`event.dataTransfer?.items`) should be in *protected mode*. 

In protected mode, "The formats and kinds in the drag data store list of items representing dragged data can be enumerated, but the data itself is unavailable and no new data can be added.". 

In Chrome and Firefox, `items` behave according to the spec. However, in Safari, `items` cannot be enumerated.

This is problematic for file dragging.

For file drag operations, there is no "dragstart" event. So in Safari there is no way to know how many files are being dragged until a "drop" event

Reproducible example: https://codesandbox.io/s/file-drag-and-drop-for-webkit-issue-s94jk1?file=/src/index.ts

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220809/23fe00d0/attachment.htm>


More information about the webkit-unassigned mailing list