diff --git a/source b/source index dce024a305f..8a71f1d0b5f 100644 --- a/source +++ b/source @@ -61598,11 +61598,18 @@ interface HTMLDialogElement : HTMLElement {
  • Set this's previously focused element to the focused element.

  • +
  • Let document be this's node document.

  • +
  • Let hideUntil be the result of running topmost popover ancestor - given this, null, and false.

  • + given this, document's showing hint popover list, null, and + false.

    -
  • If hideUntil is null, then set hideUntil to this's - node document.

  • +
  • If hideUntil is null, then set hideUntil to the result of running + topmost popover ancestor given this, document's + showing auto popover list, null, and false.

  • + +
  • If hideUntil is null, then set hideUntil to + document.

  • Run hide all popovers until given hideUntil, false, and true.

  • @@ -61674,11 +61681,18 @@ interface HTMLDialogElement : HTMLElement {
  • Set this's previously focused element to the focused element.

  • +
  • Let document be this's node document.

  • +
  • Let hideUntil be the result of running topmost popover ancestor - given this, null, and false.

  • + given this, document's showing hint popover list, null, and + false.

    -
  • If hideUntil is null, then set hideUntil to this's - node document.

  • +
  • If hideUntil is null, then set hideUntil to the result of running + topmost popover ancestor given this, document's + showing auto popover list, null, and false.

  • + +
  • If hideUntil is null, then set hideUntil to + document.

  • Run hide all popovers until given hideUntil, false, and true.

  • @@ -85217,6 +85231,16 @@ dictionary DragEventInit : MouseEventInit { manual Does not close other popovers; does not light dismiss or respond to close requests. + + + hint + hint + Closes other hint popovers when opened, but not other auto popovers; has light dismiss and responds to close requests. + +

    The attribute's missing value default is the DragEventInit : MouseEventInit { data-x="popover-showing-state">showing

    -

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

    Every HTML element has a popover invoker, which @@ -85255,6 +85279,9 @@ dictionary DragEventInit : MouseEventInit {

    Every HTML element has a popover close watcher, which is a close watcher or null, initially null.

    +

    Every HTML element has an opened in popover + mode, which is a string or null, initially null.

    +

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

    @@ -85316,6 +85343,8 @@ dictionary DragEventInit : MouseEventInit {
  • Let nestedShow be element's popover showing or hiding.

  • +
  • Let fireEvents be the boolean negation of nestedShow.

  • +
  • Set element's popover showing or hiding to true.

  • @@ -85347,22 +85376,87 @@ dictionary DragEventInit : MouseEventInit {
  • Let shouldRestoreFocus be false.

  • +
  • Let originalType be the current state of element's popover attribute.

  • + +
  • Let stackToAppendTo be null.

  • + +
  • Let autoAncestor be the result of running the topmost popover + ancestor algorithm given element, document's showing auto + popover list, invoker, and true.

  • + +
  • Let hintAncestor be the result of running the topmost popover + ancestor algorithm given element, document's showing hint + popover list, invoker, and true.

  • +
  • -

    If element's popover attribute is in the auto state, then:

    +

    If originalType is the auto state, + then:

      -
    1. Let originalType be the value of element's popover attribute.

    2. +
    3. Run close entire popover list given document's showing + hint popover list, shouldRestoreFocus, and fireEvents.

    4. Let ancestor be the result of running the topmost popover - ancestor algorithm given element, invoker, and true.

    5. + ancestor algorithm given element, document's showing auto + popover list, invoker, and true.

    6. If ancestor is null, then set ancestor to document.

    7. Run hide all popovers until given - ancestor, false, and not nestedShow.

    8. + ancestor, shouldRestoreFocus, and fireEvents.

      + +
    9. Set stackToAppendTo to "auto".

    10. +
    +
  • + +
  • +

    If originalType is the hint state, + then:

    + +
      +
    1. +

      If hintAncestor is not null, then:

      + +
        +
      1. Run hide all popovers until given + hintAncestor, shouldRestoreFocus, and fireEvents.

      2. + +
      3. Set stackToAppendTo to "hint".

      4. +
      +
    2. + +
    3. +

      Otherwise:

      + +
        +
      1. Run close entire popover list given document's showing + hint popover list, shouldRestoreFocus, and fireEvents.

      2. + +
      3. +

        If autoAncestor is not null, then:

        + +
          +
        1. Run hide all popovers until given + autoAncestor, shouldRestoreFocus, and fireEvents.

        2. + +
        3. Set stackToAppendTo to "auto".

        4. +
        +
      4. + +
      5. Otherwise, set stackToAppendTo to "hint".

      6. +
      +
    4. +
    +
  • + +
  • +

    If originalType is auto or hint, then:

    + +
      +
    1. Assert: stackToAppendTo is not null.

    2. If originalType is not equal to the value of element's DragEventInit : MouseEventInit {

    3. -

      If the result of running topmost auto popover on document is null, - then set shouldRestoreFocus to true.

      +

      If the result of running topmost auto or hint + popover on document is null, then set shouldRestoreFocus to + true.

      This ensures that focus is returned to the previously-focused element only for the first popover in a stack.

    4. +
    5. +

      If stackToAppendTo is "auto":

      + +
        +
      1. Assert: document's showing auto popover list does + not contain element.

      2. + +
      3. Set element's opened in popover mode to "auto".

      4. +
      + +

      Otherwise:

      + +
        +
      1. Assert: stackToAppendTo is "hint".

      2. + +
      3. Assert: document's showing hint popover list does + not contain element.

      4. + +
      5. Set element's opened in popover mode to "hint".

      6. +
      +
    6. +
    7. If document is fully active, then set element's popover close watcher to the result of popover attribute is in the auto state, then:

      + data-x="attr-popover-auto-state">auto state or the hint state, then:

      1. Run hide all popovers until given @@ -85586,6 +85707,8 @@ dictionary DragEventInit : MouseEventInit {

      2. Otherwise, remove an element from the top layer immediately given element.

      3. +
      4. Set element's opened in popover mode to null.

      5. +
      6. Set element's popover visibility state to hidden.

      7. @@ -85653,33 +85776,62 @@ dictionary DragEventInit : MouseEventInit {
      8. Let document be endpoint's node document.

      9. +
      10. Assert: endpoint is a Document or + endpoint's popover visibility state is showing.

      11. + +
      12. Assert: endpoint is a Document or + endpoint's popover attribute is in the auto state or endpoint's popover attribute is in the hint state.

      13. +
      14. -

        Let closeAllOpenPopovers be an algorithm which performs the following steps:

        +

        If endpoint is a Document:

          -
        1. Let popover be document's topmost auto - popover.

        2. +
        3. Run close entire popover list given document's showing + hint popover list, focusPreviousElement, and fireEvents.

        4. -
        5. -

          While popover is not null:

          +
        6. Run close entire popover list given document's showing + auto popover list, focusPreviousElement, and fireEvents.

        7. -
            -
          1. Run the hide popover algorithm given popover, - focusPreviousElement, fireEvents, and false.

          2. +
          3. Return.

          4. +
          + -
        8. Set popover to document's topmost auto - popover.

        9. -
        -
      15. +
      16. +

        If document's showing hint popover list contains + endpoint:

        + +
          +
        1. Assert: endpoint's popover + attribute is in the hint state.

        2. + +
        3. Run hide popover stack until given endpoint, + document's showing hint popover list, focusPreviousElement, + and fireEvents.

        4. + +
        5. Return.

      17. -
      18. If endpoint is a Document, then run - closeAllOpenPopovers and return.

      19. +
      20. Run close entire popover list given document's showing hint + popover list, focusPreviousElement, and fireEvents.

      21. + +
      22. If document's showing auto popover list does not contain + endpoint, then return.

      23. -
      24. Assert: endpoint's popover - attribute is in the auto state.

      25. +
      26. Run hide popover stack until given endpoint, document's + showing auto popover list, focusPreviousElement, and + fireEvents.

      27. +
      +

      To hide popover stack until, given an HTML + element element, a list popoverList, a boolean + focusPreviousElement, and a boolean fireEvents:

      + +
      1. Let repeatingHide be false.

      2. @@ -85688,39 +85840,37 @@ dictionary DragEventInit : MouseEventInit {
        1. Let lastToHide be null.

        2. -
        3. Let foundEndpoint be false.

        4. -
        5. -

          For each popover of document's showing auto popover - list:

          +

          For each popover in popoverList:

            -
          1. If popover is endpoint, then set foundEndpoint to - true.

          2. +
          3. If popover is endpoint, then break.

          4. -
          5. Otherwise, if foundEndpoint is true, then set lastToHide to - popover and break.

          6. +
          7. Set lastToHide to popover.

        6. -
        7. If foundEndpoint is false, then run closeAllOpenPopovers and - return.

        8. +
        9. If lastToHide is null, then return.

        10. -

          While lastToHide is not null and lastToHide's popover - visibility state is showing and - document's showing auto popover list is not empty:

          +

          While lastToHide's popover visibility state is showing:

            -
          1. Run the hide popover algorithm given document's showing - auto popover list's last element, focusPreviousElement, - fireEvents, and false.

          2. +
          3. Assert: popoverList is not empty.

          4. + +
          5. Run the hide popover algorithm given the last item in + popoverList, focusPreviousElement, fireEvents, and + false.

        11. -
        12. Set repeatingHide to true if document's showing auto popover - list contains endpoint and document's showing auto popover - list's last element is not endpoint, otherwise false.

        13. +
        14. Assert: repeatingHide is false or popoverList's + last item is endpoint.

        15. + +
        16. Set repeatingHide to true if popoverList contains + endpoint and popoverList's last item is not endpoint, + otherwise false.

        17. If repeatingHide is true, then set fireEvents to false.

        @@ -85735,9 +85885,10 @@ dictionary DragEventInit : MouseEventInit { the popovers that aren't related to the node clicked by the user.

        To find the topmost popover ancestor, given a Node - newPopoverOrTopLayerElement, an HTML element or - null invoker, and a boolean isPopover, perform the following steps. They - return an HTML element or null.

        + newPopoverOrTopLayerElement, a list popoverList, an HTML element or null invoker, and a boolean + isPopover, perform the following steps. They return an HTML element or null.

        The topmost popover ancestor algorithm will return the topmost (latest in the @@ -85803,8 +85954,7 @@ dictionary DragEventInit : MouseEventInit { document.

      3. -

        For each popover of document's showing auto popover - list:

        +

        For each popover of popoverList:

        1. Set popoverPositions[popover] to @@ -85828,10 +85978,35 @@ dictionary DragEventInit : MouseEventInit {

          1. If candidate is null, then return.

          2. -
          3. Let candidateAncestor be the result of running nearest inclusive open - popover given candidate.

          4. +
          5. Let okNesting be false.

          6. + +
          7. Let candidateAncestor be null.

          8. + +
          9. +

            While okNesting is false:

            + +
              +
            1. Set candidateAncestor to the result of running nearest inclusive open + popover given candidate.

            2. + +
            3. If candidateAncestor is null or popoverPositions does not + contain candidateAncestor, then return.

            4. -
            5. If candidateAncestor is null, then return.

            6. +
            7. Assert: candidateAncestor's popover attribute is not in the manual or none state.

            8. + +
            9. Set okNesting to true if newPopover's popover attribute is in the hint state or candidateAncestor's popover attribute is in the auto state.

            10. + +
            11. If okNesting is false, then set candidate to + candidateAncestor's parent in the flat tree.

            12. +
            +
          10. Let candidatePosition be popoverPositions[candidateAncestor].

          11. @@ -85875,11 +86050,14 @@ dictionary DragEventInit : MouseEventInit {
          12. Return null.

          -

          To find the topmost auto popover given a +

          To find the topmost auto or hint popover given a Document document, perform the following steps. They return an HTML element or null.

            +
          1. If document's showing hint popover list is not empty, then return + document's showing hint popover list's last element.

          2. +
          3. If document's showing auto popover list is not empty, then return document's showing auto popover list's last element.

          4. @@ -85984,16 +86162,80 @@ dictionary DragEventInit : MouseEventInit {
            1. Let popovers be « ».

            2. -
            3. For each Element element in - document's top layer: if element's popover attribute is in the auto state and element's popover - visibility state is showing, then append element to popovers.

            4. +
            5. +

              For each Element element in + document's top layer:

              + +
                +
              1. +

                If all of the following are true:

                + +
                  +
                • element is an HTML element;

                • + +
                • element's opened in popover mode is "auto"; and

                • + +
                • element's popover visibility state is showing, +

                + +

                then append element to + popovers.

                +
              2. +
              +
            6. Return popovers.

            +

            To get the showing hint popover list for a Document + document:

            + +
              +
            1. Let popovers be « ».

            2. + +
            3. +

              For each Element element in + document's top layer:

              + +
                +
              1. +

                If all of the following are true:

                + +
                  +
                • element is an HTML element;

                • + +
                • element's opened in popover mode is "hint"; and

                • + +
                • element's popover visibility state is showing, +

                + +

                then append element to + popovers.

                +
              2. +
              +
            4. + +
            5. Return popovers.

            6. +
            + +

            To close entire popover list given a list popoverList, a + boolean focusPreviouselement, and a boolean fireEvents:

            + +
              +
            1. +

              While popoverList is not empty:

              + +
                +
              1. Run the hide popover algorithm given popoverList's last item, + focusPreviousElement, fireEvents, and false.

              2. +
              +
            2. +
            +

            The popover target attributes

            Buttons may have the following content attributes:

            @@ -86207,26 +86449,31 @@ dictionary DragEventInit : MouseEventInit {
          5. Let invokerPopover be the result of running nearest inclusive target popover for invoker given node.

          6. -
          7. -

            Let getStackPosition be an algorithm which performs the following steps given - an HTML element popover:

            +
          8. If the result of getting the popover stack + position given clickedPopover is greater than the result of getting the popover stack position given + invokerPopover, then return clickedPopover.

          9. -
              -
            1. Let popoverList be popover's node document's - showing auto popover list.

            2. +
            3. Return invokerPopover.

            4. +
            -
          10. If popover is in popoverList, then return the index of - popover in popoverList + 1.

          11. +

            To get the popover stack position, given an HTML + element popover:

            -
          12. Return 0.

          13. -
          -
        2. +
            +
          1. Let hintList be popover's node document's + showing hint popover list.

          2. -
          3. If the result of running getStackPosition given clickedPopover is - greater than the result of running getStackPosition given invokerPopover, - then return clickedPopover.

          4. +
          5. Let autoList be popover's node document's + showing auto popover list.

          6. -
          7. Return invokerPopover.

          8. +
          9. If popover is in hintList, then return the index of + popover in hintList + the size of autoList + 1.

          10. + +
          11. If popover is in autoList, then return the index of + popover in autoList + 1.

          12. + +
          13. Return 0.

          To find the nearest inclusive target popover for invoker given a Node