Page MenuHomePhabricator

Improve behavior when users drag-and-drop upload something that isn't a file
Open, Needs TriagePublic

Description

See screenshot. Unless maybe this is a feature? I don't see how one would upload files while dragging the tag though.

dd_proj_cp.png (1×1 px, 441 KB)

Event Timeline

sshannin raised the priority of this task from to Needs Triage.
sshannin updated the task description. (Show Details)
sshannin added a subscriber: sshannin.
chad renamed this task from Dragging project tags triggers file upload mode to Dragging any URL triggers file upload mode on home.Feb 5 2015, 10:59 PM
chad added a project: PHUI.

From what I can tell, it seems like this is possible, but very complicated.

When the user drags something into the window, we aren't allowed to see what it actually is until they drop it (I think for security reasons, so websites can't see your data if you just wave files over them).

We can access dataTransfer.types to try to figure out what they're dropping, but this property is ridiculous:

On CursorBrowserOSTypes
Text FileSafariOSX Yosemite["public.file-url", "CorePasteboardFlavorType 0x6675726C", "dyn.ah62d4rv4gu8y6y4grf0gn5xbrzw1gydcr7u1e3cytf2gn", "text/uri-list", "Files", "dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu", "com.apple.finder.node"]
URLSafariOSX Yosemite["dyn.ah62d4rv4gu8zs3pcnzme2641rf4guzdmsv0gn64uqm10c6xenv61a3k", "WebURLsWithTitlesPboardType", "dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu", "text/uri-list", "public.url", "CorePasteboardFlavorType 0x75726C20", "public.url-name", "CorePasteboardFlavorType 0x75726C6E", "public.utf8-plain-text", "text/plain"]
ImageFirefoxOSX Yosemite["application/x-moz-file", "Files"]
URLFirefoxOSX Yosemite[ "text/x-moz-url", "text/x-moz-url-data", "text/x-moz-url-desc", "text/uri-list", "text/_moz_htmlcontext", "text/_moz_htmlinfo", "text/html", "text/plain" ]
Text FileChromeOSX Yosmemite["Files"]
URLChromeOSX Yosemite["text/plain", "text/uri-list", "text/html"]

Possibly we can find some library which already deals with this mess; otherwise we need to enumerate a zillion browser/OS/file type combinations and come up with ways to detect files vs URLs vs whatever else.

Oh dang, that's gross.

As an alternative, could probably just make the elements undraggable? I think that's easy to do, and I doubt people get much utility out of dragging = various URL's around the page.

That being said, it's not like the current behavior is really causing problems, so this might not be worth the effort.

You can grab URLs from all over the place in lots of browsers (url bar, bookmark bar, tabs, etc).

epriestley renamed this task from Dragging any URL triggers file upload mode on home to Improve behavior when users drag-and-drop upload something that isn't a file.Mar 2 2015, 4:29 PM
epriestley added a subscriber: mynamewastolen.

T7129 is very similar and discusses another type of non-file resource which users can drag and drop.

I was hoping to have some time to play around with this a little more. Firefox and Chrome on Windows 8.1 looks more or less the same as your results.

Bookmark looks more or less like a normal URL except I'm getting x-moz-place for it in Firefox. I presume that stuff like tabs, bookmarks, etc. will be similarly unique on all browsers.

On cursorBrowserOS Types
URL BookmarkFirefox 36.0Windows 8.1text/html text/plain text/x-moz-url text/x-moz-place
TabFirefox 36.0Windows 8.1application/x-moz-tabbrowser-tab
Zip from 7Zip DialogFirefox 36.0Windows 8.1application/x-moz-file text/x-moz-url Files
Zip from Windows Explorer DialogFirefox 36.0Windows 8.1Doesn't work
URL BookmarkChrome 40.0Windows 8.1text/plain text/uri-list
TabChrome 40.0Windows 8.1Tabs detach when dragged
Zip from 7Zip DialogChrome 40.0Windows 8.1Files
Zip from Windows Explorer DialogChrome 40.0Windows 8.1Doesn't work

Just using a hack of scripts from the W3.org Drag and Drop article and google searching.

EDIT: Doesn't work also means I get no type.

T8077 is similar issue but for images drug in, though we shouldn't be trying to convert images if we don't know if it's a file (and filling logs)