Skip to content

Commit

Permalink
Add a "cancel" event for when file upload selection is unchanged
Browse files Browse the repository at this point in the history
Closes #6376.
  • Loading branch information
domenic committed Jun 3, 2021
1 parent 0e2bdcf commit 04ee7d1
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -47817,11 +47817,11 @@ ldh-str = &lt; as defined in <a href="https://tools.ietf.org/html/rfc1034#
no more than one file in the list of <span data-x="concept-input-type-file-selected">selected
files</span>.</p>

<p>The element's <span>input activation behavior</span> is to run the following steps:</p>
<p>The <span>input activation behavior</span> for such an element <var>element</var> is:</p>

<ol>
<li><p>If the algorithm is invoked when the element's <code>Window</code> object does not have
<span>transient activation</span>, then return without doing anything else.</p></li>
<li><p>If the algorithm is invoked when <var>element</var>'s <span>relevant global object</span>
does not have <span>transient activation</span>, then return.</p></li>

<li>
<p>Run these steps <span>in parallel</span>:</p>
Expand All @@ -47830,15 +47830,30 @@ ldh-str = &lt; as defined in <a href="https://tools.ietf.org/html/rfc1034#
<li><p>Optionally, wait until any prior execution of this algorithm has terminated.</p></li>

<li><p>Display a prompt to the user requesting that the user specify some files. If the <code
data-x="attr-input-multiple">multiple</code> attribute is not set, there must be no more than
one file selected; otherwise, any number may be selected. Files can be from the filesystem or
created on the fly, e.g., a picture taken from a camera connected to the user's
device.</p></li>
data-x="attr-input-multiple">multiple</code> attribute is not set on <var>element</var>, there
must be no more than one file selected; otherwise, any number may be selected. Files can be
from the filesystem or created on the fly, e.g., a picture taken from a camera connected to the
user's device.</p></li>

<li><p>Wait for the user to have made their selection.</p></li>

<li><p><span>Update the file selection</span> for the <code>input</code> element.</p></li>
<li><p>If the user dismissed the prompt without changing their selection, then <span>queue an
element task</span> on the <span>user interaction task source</span> given <var>element</var>
to <span data-x="concept-event-fire">fire an event</span> named <code
data-x="event-cancel">cancel</code> at <var>element</var>.</p></li>

<li><p>Otherwise, <span>update the file selection</span> for <var>element</var>.</p></li>
</ol>

<p class="note">As with all user interface specifications, user agents have a good deal of
freedom in how they interpret these requirements. The above text implies that a user either
dismisses the prompt (in which case <code data-x="event-cancel">cancel</code> fires) or changes
their selection (in which case <code data-x="event-input">input</code> and <code
data-x="event-change">change</code> fire); exactly one of these will be true. But the mapping of
these possibilities to specific user interface elements is not mandated by the standard. For
example, a user agent might interpret clicking the "Cancel" button when files were previously
selected as a change of selection to select zero files. Or it might interpret such a click as a
dismissal that leaves the selection unchanged.</p>
</li>
</ol>

Expand Down

0 comments on commit 04ee7d1

Please sign in to comment.