diff --git a/proposal.html b/proposal.html index b693549..d27dcbe 100644 --- a/proposal.html +++ b/proposal.html @@ -109,6 +109,7 @@
When this specification says to return a file or directory sequence promise on a given present working directory, the user agent should run the following steps:
If the result of running is settings object a secure context with the incumbent settings object is Not Secure
, return a new promise rejected with a "SecurityError
" exception.
Let p be a new promise and s a sequence, initially set to an empty sequence.
Run the following steps asynchronously:
Return p.
A common method on both the HTMLInputElement
and on the Directory
interface called getFilesAndDirectories()
returns files and subdirectories for a given directory using the steps above. Each method invoking the steps above must specify what to consider as the present working directory.
When an input
element's type
attribute is in the File Upload state, the rules in this section apply [[!HTML]].
User agents may surface a directory picker, which may also serve as a file picker; this is an unspecified piece of user interface that a user agent may deploy, and may expand upon any existing user interface already in place for selecting files when the input
element's type
attribute is in the File Upload state. This generally happens synchronously and is considered a blocking operation. When this specification says to trigger a directory picker a user agent must follow the steps below (and may optionally follow the steps labeled "may" [[!RFC2119]]):
If the result of running is settings object a secure context with the incumbent settings object is Not Secure
, the user agent must throw a SecurityError
exception and additionally may prevent a directory picker from being shown at all.
If the user agent is capable of surfacing both a directory picker and a file picker in a single user interface element, this user agent is said to have a Single File and Directory Picker. This user agent must expose a value of true
on the isFilesAndDirectoriesSupported
attribute of the HTMLInputElement
.
User agents in practice may reuse user interface elements from the host OS. If the host OS supports a Single File and Directory Picker a file input with a single button that enables the combined picker may be rendered and may resemble the suggested user interface element below:
+ +Currently, only OSX exposes a unified picker.
If the user agent does not have a Single File and Directory Picker it is said to have Distinct File and Directory Pickers. This user agent must expose a value of false
on the isFilesAndDirectoriesSupported
attribute of the HTMLInputElement
.
If the user agent has Distinct File and Directory Pickers, possibly reusing user interface elements from the host OS, a file input that enables two separate pickers (file and directory) via two different buttons may be rendered and may resemble the suggested user interface element below:
+ + +If the user agent has Distinct File and Directory Pickers and is set to trigger in Directory Picker Only mode, it may only surface a picker that allows for directory picking, or it may surface a picker featuring two separate buttons as in figure two above. The suggested user interface element below may be used to surface an option to only pick directories:
+ + +If the host OS supports a combined file and directory picker (i.e. HTMLInputElement.isFilesAndDirectoriesSupported === true
) a file input with a single button that enables the combined picker MUST be rendered:
If it is not supported (i.e. HTMLInputElement.isFilesAndDirectoriesSupported === false
) a file input that enables two separate pickers (file and directory) via two different buttons MUST be rendered:
The default click behavior of such a file input MUST trigger the file picker. Calling HTMLInputElement.chooseDirectory on the file input element MUST trigger the directory picker.
HTMLInputElement.isFilesAndDirectoriesSupported -On getting, this attribute is true
if the host OS supports a single dialog capable of picking both files and directories simultaneously, false
otherwise.
On getting, this attribute must be true
if the user agent will expose a Single File and Directory Picker, and false
if the user agent will expose Distinct File and Directory Pickers.
When the getFilesAndDirectories()
method is called, the user agent must run the steps below:
Triggers the directory picker if HTMLInputElement.isFilesAndDirectoriesSupported === false
, otherwise triggers the default click behavior of the input element.
When the choseDirectory()
method is called, a user agent must trigger a directory picker in Directory Picker Only mode.