{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/html/issues/1777","repository_url":"https://api.github.com/repos/whatwg/html","labels_url":"https://api.github.com/repos/whatwg/html/issues/1777/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/html/issues/1777/comments","events_url":"https://api.github.com/repos/whatwg/html/issues/1777/events","html_url":"https://github.com/whatwg/html/issues/1777","id":176634547,"number":1777,"title":"Allow code to detect whether file or folder has been drag/dropped onto element","user":{"login":"jez9999","id":793830,"avatar_url":"https://avatars.githubusercontent.com/u/793830?v=3","gravatar_id":"","url":"https://api.github.com/users/jez9999","html_url":"https://github.com/jez9999","followers_url":"https://api.github.com/users/jez9999/followers","following_url":"https://api.github.com/users/jez9999/following{/other_user}","gists_url":"https://api.github.com/users/jez9999/gists{/gist_id}","starred_url":"https://api.github.com/users/jez9999/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jez9999/subscriptions","organizations_url":"https://api.github.com/users/jez9999/orgs","repos_url":"https://api.github.com/users/jez9999/repos","events_url":"https://api.github.com/users/jez9999/events{/privacy}","received_events_url":"https://api.github.com/users/jez9999/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-13T13:03:49Z","updated_at":"2016-09-13T14:19:35Z","closed_at":null,"body":"When a file is drag/dropped onto an element, the event passed into the relevant event handlers (for example, the \"ondrop\" handler) is a [DataTransfer](https://html.spec.whatwg.org/#datatransfer) object.\r\n\r\nThis exposes - amongst other things - an 'items' property, which is a [DataTransferItemList](https://html.spec.whatwg.org/#datatransferitemlist), allowing access to the [DataTransferItem](https://html.spec.whatwg.org/#datatransferitem)s for that drag/drop operation.\r\n\r\nThe 'kind' property on that object is \"string\" or \"file\", but this does not address the case when a user drag/drops a directory into the element.  Firefox simply lies to the JavaScript and puts the directory into the list as a file, which it is not.  Attempts to read that file will fail with a SecurityError.\r\n\r\nI propose that the 'kind' property must have the value \"directory\" if the item is a directory has been drag/dropped.\r\n\r\nAlternatively, Google Chrome has implemented a different solution whereby DataTransferItem has a \"getAsEntry()\" function on it, returning either a FileEntry or DirectoryEntry object, also indicating whether the item drag/dropped is a directory or not.  This solution could be in the standard instead.  The Chrome implementation is detailed at:\r\nhttps://developers.google.com/web/updates/2012/07/Drag-and-drop-a-folder-onto-Chrome-now-available?hl=en"},"comment":{"url":"https://api.github.com/repos/whatwg/html/issues/comments/246696580","html_url":"https://github.com/whatwg/html/issues/1777#issuecomment-246696580","issue_url":"https://api.github.com/repos/whatwg/html/issues/1777","id":246696580,"user":{"login":"zcorpan","id":244772,"avatar_url":"https://avatars.githubusercontent.com/u/244772?v=3","gravatar_id":"","url":"https://api.github.com/users/zcorpan","html_url":"https://github.com/zcorpan","followers_url":"https://api.github.com/users/zcorpan/followers","following_url":"https://api.github.com/users/zcorpan/following{/other_user}","gists_url":"https://api.github.com/users/zcorpan/gists{/gist_id}","starred_url":"https://api.github.com/users/zcorpan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcorpan/subscriptions","organizations_url":"https://api.github.com/users/zcorpan/orgs","repos_url":"https://api.github.com/users/zcorpan/repos","events_url":"https://api.github.com/users/zcorpan/events{/privacy}","received_events_url":"https://api.github.com/users/zcorpan/received_events","type":"User","site_admin":false},"created_at":"2016-09-13T14:19:35Z","updated_at":"2016-09-13T14:19:35Z","body":"That's issue https://github.com/WICG/entries-api/issues/7"}}
{"actor":{"display_login":"zcorpan"}}