From 3c37dfbe0b08b8c2038061b2074b1c9ea87c7970 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 3 Jun 2021 16:29:41 -0400 Subject: [PATCH 1/3] Add a "cancel" event for when file upload selection is unchanged Closes #6376. --- source | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/source b/source index a92a00a0afb..22526bc9ac5 100644 --- a/source +++ b/source @@ -47817,11 +47817,11 @@ ldh-str = < as defined in selected files.

-

The element's input activation behavior is to run the following steps:

+

The input activation behavior for such an element element is:

    -
  1. If the algorithm is invoked when the element's Window object does not have - transient activation, then return without doing anything else.

  2. +
  3. If the algorithm is invoked when element's relevant global object + does not have transient activation, then return.

  4. Run these steps in parallel:

    @@ -47830,15 +47830,30 @@ ldh-str = < as defined in
    multiple 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.

  5. + data-x="attr-input-multiple">multiple attribute is not set on element, 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.

  6. Wait for the user to have made their selection.

  7. -
  8. Update the file selection for the input element.

  9. +
  10. If the user dismissed the prompt without changing their selection, then queue an + element task on the user interaction task source given element + to fire an event named cancel at element.

  11. + +
  12. Otherwise, update the file selection for element.

+ +

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 cancel fires) or changes + their selection (in which case input and change 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.

@@ -123468,8 +123483,8 @@ INSERT INTERFACES HERE cancel Event - dialog elements - Fired at dialog elements when they are canceled by the user (e.g. by pressing the Escape key) + dialog elements, input elements + Fired at dialog elements when they are canceled by the user (e.g. by pressing the Escape key), or at input elements in the File state when the user does not change their selection change From 6989420e6f95ffe70c21fb36e75dd471807a5b3a Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 17 Jun 2021 13:55:09 -0400 Subject: [PATCH 2/3] Review comments --- source | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source b/source index 22526bc9ac5..e5355a57b97 100644 --- a/source +++ b/source @@ -47847,13 +47847,13 @@ ldh-str = < as defined in
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 cancel fires) or changes - their selection (in which case input and change 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.

+ dismisses the prompt or changes their selection; 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, thus firing input and change. Or it might + interpret such a click as a dismissal that leaves the selection unchanged, thus firing cancel.

@@ -123484,7 +123484,7 @@ INSERT INTERFACES HERE cancel Event dialog elements, input elements - Fired at dialog elements when they are canceled by the user (e.g. by pressing the Escape key), or at input elements in the File state when the user does not change their selection + Fired at dialog elements when they are canceled by the user (e.g., by pressing the Escape key), or at input elements in the File state when the user does not change their selection change From 5b15293a81f41012a2da7f83b4160eca0aed1c58 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 8 Jul 2021 12:40:03 -0400 Subject: [PATCH 3/3] Review feedback --- source | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source b/source index e5355a57b97..5664e03e9ee 100644 --- a/source +++ b/source @@ -47840,7 +47840,8 @@ ldh-str = < as defined in
fire an event named cancel at element.

+ data-x="event-cancel">cancel at element, with the bubbles attribute initialized to true.

  • Otherwise, update the file selection for element.

  • @@ -47853,7 +47854,9 @@ ldh-str = < as defined in
    input and change. Or it might interpret such a click as a dismissal that leaves the selection unchanged, thus firing cancel.

    + data-x="event-cancel">cancel. Similarly, it's up to the user agent whether re-selecting + the same files counts as were previously selected counts as a dismissal, or as a change of + selection.