diff --git a/source b/source index b35091503a7..7a02a279efd 100644 --- a/source +++ b/source @@ -61158,6 +61158,7 @@ interface HTMLDetailsElement : HTMLElement {
Flow content.
Content attributes:
Global attributes
+
closedby
open
Accessibility considerations:
@@ -61171,6 +61172,7 @@ interface HTMLDialogElement : HTMLElement { [CEReactions] attribute boolean open; attribute DOMString returnValue; + [CEReactions] attribute DOMString closedBy; [CEReactions] undefined show(); [CEReactions] undefined showModal(); [CEReactions] undefined close(optional DOMString returnValue); @@ -61266,6 +61268,38 @@ interface HTMLDialogElement : HTMLElement { is a boolean attribute. When specified, it indicates that the dialog element is active and that the user can interact with it.

+

The closedby + content attribute is an enumerated attribute with the following keywords and + states:

+ + + + + + + + +
Keyword + State + Brief description +
any + Any + Close requests or clicking outside closes the dialog. +
closerequest + Close Request + Close requests close the dialog. +
none + None + Nothing automatically closes the dialog. +
+ +

The closedby attribute's invalid value default and missing value + default are both the Auto state. The auto state matches closerequest when the element is modal; + otherwise none.

+

A dialog element without an open attribute @@ -61343,6 +61377,27 @@ interface HTMLDialogElement : HTMLElement {

  • Add an open attribute to this, whose value is the empty string.

  • +
  • +

    Set this's close watcher to the + result of establishing a close watcher given + this's relevant global object, with:

    + + +
  • +
  • Set this's previously focused element to the focused element.

  • @@ -61409,6 +61464,12 @@ interface HTMLDialogElement : HTMLElement {
  • closeAction being to close the dialog given this and null.

  • + +
  • enabled being true if this's + closedby attribute is in the Any, Close Request, or Auto state; otherwise false.

  • @@ -61599,6 +61660,9 @@ interface HTMLDialogElement : HTMLElement {
    +

    The Document has a dialog pointerdown target, which is an HTML dialog element or null, initially null.

    +

    Each dialog element has a close watcher, which is a close watcher or null, initially null.

    @@ -61613,8 +61677,42 @@ interface HTMLDialogElement : HTMLElement { attribute set this element to the currently focused element during the show popover algorithm.

    +

    The following attribute change + steps, given element, localName, oldValue, + value, and namespace, are used for HTML + dialog elements:

    + +
      +
    1. If namespace is not null, then return.

    2. + +
    3. If localName is not closedby, then + return.

    4. + +
    5. If element has no open attribute, then + return.

    6. + +
    7. If oldValue and value are in the same state, then return.

    8. + +
    9. Assert: element's close + watcher is not null.

    10. + +
    11. If value is in the Any state, + or Close Request state, + or Auto state and element's is + modal flag is true, then let enabled to true; otherwise false.

    12. + +
    13. Set element's close watcher's enabled boolean to enabled.

    14. +
    +
    +

    The closedBy IDL attribute must reflect the + closedby content attribute, limited to only + known values.

    +

    The open IDL attribute must reflect the open content attribute.

    @@ -61635,7 +61733,110 @@ interface HTMLDialogElement : HTMLElement { </dialog>
    +

    Dialog light dismiss

    + +

    "Light dismiss" means that clicking outside of a dialog whose closedby attribute is in the any state will close the dialog. This is in addition to + how such dialogs respond to close requests.

    + +

    To light dismiss open dialogs, given an Event event:

    + +
      +
    1. Assert: event's isTrusted attribute is true.

    2. + +
    3. Let target be event's target.

    4. + +
    5. Let document be target's node document.

    6. + +
    7. If document's showing any dialog list is empty, then + return.

    8. + +
    9. If event is a PointerEvent and event's type is "pointerdown", + then: set document's dialog pointerdown target to the result of running + topmost clicked dialog given target.

    10. + +
    11. +

      If event is a PointerEvent and event's type is "pointerup", + then:

      + +
        +
      1. Let clickedDialog be the result of running topmost clicked + dialog given target.

      2. + +
      3. Let topDialog be document's showing any dialog + list's last element.

      4. + +
      5. Let clickedTopDialog be clickedDialog is topDialog, or + clickedDialog is dialog pointerdown target

      6. + +
      7. Set document's dialog pointerdown target to null.

      8. + +
      9. If clickedTopDialog, then return.

      10. + +
      11. Perform close the dialog given topDialog.

      12. +
      +
    12. +
    + +

    Light dismiss open dialogs will be called by the Pointer Events spec when the user clicks + or touches anywhere on the page.

    + +

    To find the topmost clicked dialog, given a Node node:

    + +
      +
    1. Let clickedDialog be the result of running nearest inclusive open + dialog given node.

    2. + +
    3. Return clickedDialog.

    4. +
    + +

    To get the showing any dialog list for a + Document document:

    + +
      +
    1. Let dialogs be « ».

    2. + +
    3. For each Element element in + document's top layer: if element is a dialog element, element's closedby attribute is in the any state and element has an open attribute, then append + element to dialogs.

    4. + +
    5. Return dialogs.

    6. +
    + +

    To find the nearest inclusive open dialog given a Node + node, perform the following steps. They return an HTML dialog element or null.

    + +
      +
    1. Let currentNode be node.

    2. + +
    3. +

      While currentNode is not null:

      + +
        +
      1. If currentNode is an HTML dialog + element, currentNode's closedby + attribute is in the any state and + currentNode has an open attribute, then + return currentNode.

      2. +
      3. Set currentNode to currentNode's parent in the flat + tree.

      4. +
      +
    4. + +
    5. Return null.

    6. +

    Scripting

    @@ -82112,6 +82313,8 @@ body { display:none }
  • An is running cancel action boolean.

  • + +
  • An enabled boolean.

  • A close watcher closeWatcher is @@ -82122,8 +82325,10 @@ body { display:none }


    To establish a close watcher given a Window window, a list - of steps cancelAction, and a - list of steps closeAction:

    + of steps cancelAction, a + list of steps closeAction, + and an optional boolean enabled + (default true):

    1. Assert: window's is running cancel action

      false
      + +
      enabled
      +
      enabled
    2. @@ -82184,6 +82392,9 @@ body { display:none }
    3. If closeWatcher is not active, then return true.

    4. +
    5. If closeWatcher's enabled is false, + then return true.

    6. +
    7. If closeWatcher's is running cancel action is true, then return true.

    8. @@ -82239,6 +82450,9 @@ body { display:none }
    9. If closeWatcher is not active, then return.

    10. +
    11. If closeWatcher's enabled is false, + then return true.

    12. +
    13. If closeWatcher's window's associated Document is not fully active, then return.

    14. @@ -82286,7 +82500,8 @@ body { display:none } in reverse order:

        -
      1. Set processedACloseWatcher to true.

      2. +
      3. If closeWatcher's enabled is + true, set processedACloseWatcher to true.

      4. Let shouldProceed be the result of requesting to close