W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2015

RE: Directory Upload Proposal

From: Ali Alabbas <alia@microsoft.com>
Date: Tue, 5 May 2015 17:50:47 +0000
To: Web Applications Working Group WG <public-webapps@w3.org>
Message-ID: <BY2PR03MB572EB51EAE0DA47BD7CF4EDC4D10@BY2PR03MB572.namprd03.prod.outlook.com>
I recommend that we change the "dir" attribute to "directories" and keep "directory" the same as it is now to avoid clashing with the existing "dir" attribute on the HTMLInputElement. All in favor?

As for the behavior of setting the "directories" attribute on a file input, we have the following options:

1) Expose two buttons in a file input ("choose files" and "choose directory") (see Mozilla's proposal [1])
- To activate the "choose directory" behavior of invoking the directory picker there would need to be a method on the HTMLInputElement e.g. chooseDirectory()
- To activate the "choose files" behavior of invoking the files picker, we continue to use click() on the file input

2) Expose two buttons in file input for Windows/Linux ("choose files" and "choose directory") and one button for Mac OS X ("choose files and directories")
- Allows users of Mac OS X to use its unified File/Directory picker
- Allows users of Windows/Linux to specify if they want to pick files or a directory
- However, there would still need to be a method to activate the "choose directory" button's behavior of invoking the directory picker (e.g. chooseDirectory() on the HTMLInputElement)
- This results in two different experiences depending on the OS

3) Expose only one button; Windows/Linux ("choose directory") and Mac OS X ("choose files and directories")
- Allows users of Mac OS X to use its unified File/Directory picker
- Windows/Linux users are only able to select a directory
- click() is used to activate these default behaviors (no need for an extra method such as chooseDirectory() on the HTMLInputElement interface)
- For Windows/Linux, in order to have access to a file picker, app/site developers would need to create another file input without setting the "directories" attribute 
- Can have something like isFileAndDirectorySupported so that developers can feature detect and decide if they need to have two different file inputs for their app/site (on Windows/Linux) or if they just need one (on Mac OS X) that can allow both files and directories

4) Expose only one button ("choose directory")
- User must select a directory regardless of OS or browser (this normalizes the user experience and the developer design paradigm)
- To make users pick files rather than directories, the developer simply does not set the "directories" attribute which would show the default file input
- Developers that want to allow users the option to select directory or files need to provide two different inputs regardless of OS or browser

I am leaning towards option 3 or 4 since it allows us to avoid needing an extra method such as chooseDirectory() but also allows the developer to cater the experience based on the capabilities of the OS via feature detection as is the case with option 3. It also allows us to keep the current look and feel of the file inputs meaning we don't break current sites nor do we create an experience that puts backwards compatibility at risk by outright changing the behavior of the file input.

Thanks,
Ali

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=846931
Received on Tuesday, 5 May 2015 17:51:16 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:31 UTC