From 3033334dcf8da5872ef49c89c1140c0d26fec6ce Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Tue, 19 Sep 2023 17:45:49 -0700 Subject: [PATCH 01/36] Add popover=hint Fixes https://github.com/whatwg/html/issues/9776 --- source | 140 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 101 insertions(+), 39 deletions(-) diff --git a/source b/source index ec9157348bb..5bd4c349344 100644 --- a/source +++ b/source @@ -82768,6 +82768,13 @@ dictionary DragEventInit : MouseEventInit { Does not close other popovers; does not light dismiss. + + hint + hint + Closes other hint popovers when opened; has light + dismiss; only one can be open at a time. + @@ -82792,7 +82799,10 @@ dictionary 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 Document has a showing hint popover, which is an HTML element or null, initially null.

Every HTML element has a popover invoker, which @@ -82897,7 +82907,8 @@ dictionary DragEventInit : MouseEventInit {

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

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

    1. Let originalType be the value of element's DragEventInit : MouseEventInit {

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

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

    5. +
    6. +

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

      + +
        +
      1. If document's showing hint popover is not null, then run the + hide popover algorithm given document's showing hint + popover, false, not nestedShow, and throwExceptions.

      2. + +
      3. If ancestor is not document, then run hide all popovers until given ancestor, + false, and not nestedShow.

      4. +
      +
    7. + +
    8. Otherwise, run hide all popovers until + given ancestor, false, and not nestedShow.

    9. If originalType is not equal to the value of element's popover attribute, then throw a @@ -82938,6 +82964,10 @@ dictionary DragEventInit : MouseEventInit {

  • +
  • If element's popover attribute is in the + hint state, then set document's + showing hint popover to element.

  • +
  • Set element's previously focused element to null.

  • Let originallyFocusedElement be document's focused area of the @@ -83038,11 +83068,12 @@ dictionary DragEventInit : MouseEventInit {

  • If element's 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 - element, focusPreviousElement, and fireEvents.

    2. + element, focusPreviousElement, fireEvents, and false.

    3. If the result of running check popover validity given element, @@ -83086,6 +83117,8 @@ dictionary DragEventInit : MouseEventInit {

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

    5. +
    6. Set document's showing hint popover to null.

    7. +
    8. Set element's popover visibility state to hidden.

    9. @@ -83144,7 +83177,8 @@ dictionary DragEventInit : MouseEventInit {

      To hide all popovers until, given an HTML element or Document endpoint, a boolean - focusPreviousElement, and a boolean fireEvents:

      + focusPreviousElement, a boolean fireEvents, and a boolean + hideUnrelatedPopovers:

      1. Let document be endpoint's node document.

      2. @@ -83174,53 +83208,81 @@ dictionary DragEventInit : MouseEventInit { closeAllOpenPopovers and return.

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

      4. - -
      5. Let repeatingHide be false.

      6. + attribute is not in the manual state.

      7. -

        Perform the following steps at least once:

        +

        If endpoint's popover attribute is in the + hint state, then:

          -
        1. Let lastToHide be null.

        2. - -
        3. Let foundEndpoint be false.

        4. -
        5. -

          For each popover in document's auto popover list:

          +

          If hideUnrelatedPopovers is true, then:

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

          2. - -
          3. Otherwise, if foundEndpoint is true, then set lastToHide to - popover and break.

          4. +
          5. If document's showing hint popover is not null and + document's showing hint popover is not endpoint, then run + the hide popover algorithm given focusPreviousElement, + fireEvents, and throwExceptions.

          6. + +
          7. While document's auto popover list is not empty, run the + hide popover algorithm given focusPreviousElement, + fireEvents, and throwExceptions.

        6. +
        +
      8. -
      9. If foundEndpoint is false, then run closeAllOpenPopovers and - return.

      10. +
      11. +

        Otherwise:

        + +
          +
        1. Let repeatingHide be false.

        2. -

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

          +

          Perform the following steps at least once:

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

          2. -
          -
        3. +
        4. Let lastToHide be null.

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

        7. +
        8. Let foundEndpoint be false.

        9. -
        10. If repeatingHide is true, then set fireEvents to false.

        11. -
        +
      12. +

        For each popover in document's auto popover list:

        -

        and keep performing them while repeatingHide is true.

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

        2. + +
        3. Otherwise, if foundEndpoint is true, then set lastToHide to + popover and break.

        4. +
        +
      13. + +
      14. If foundEndpoint is false, then run closeAllOpenPopovers and + return.

      15. + +
      16. +

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

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

        2. +
        +
      17. + +
      18. Set repeatingHide to true if document's auto popover + list contains endpoint and document's auto popover + list's last element is not endpoint, otherwise false.

      19. + +
      20. If repeatingHide is true, then set fireEvents to false.

      21. +
      + +

      and keep performing them while repeatingHide is true.

      + +
  • @@ -83231,7 +83293,7 @@ dictionary DragEventInit : MouseEventInit {

    To hide all popovers, given a Document document, run hide all popovers until given document, - false, and false.

    + false, false, and true.

    To find the topmost popover ancestor, given a Node newPopover, and an HTML element or null @@ -83659,7 +83721,7 @@ dictionary DragEventInit : MouseEventInit { document.

  • If sameTarget is true, then run hide - all popovers until given ancestor, false, and true.

  • + all popovers until given ancestor, false, true, and true.

    From 422f811d8ef282e5d1440805a872f4c99f5bf13c Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 21 Dec 2023 12:20:17 -0800 Subject: [PATCH 02/36] fix auto popover list --- source | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source b/source index 7bfa174685f..fbcfd8b19ed 100644 --- a/source +++ b/source @@ -84530,8 +84530,8 @@ dictionary DragEventInit : MouseEventInit { the hide popover algorithm given focusPreviousElement, fireEvents, and throwExceptions.

    -
  • While document's auto popover list is not empty, run the - hide popover algorithm given focusPreviousElement, +

  • While document's showing auto popover list is not empty, run + the hide popover algorithm given focusPreviousElement, fireEvents, and throwExceptions.

  • @@ -84553,7 +84553,8 @@ dictionary DragEventInit : MouseEventInit {
  • Let foundEndpoint be false.

  • -

    For each popover in document's auto popover list:

    +

    For each popover in document's showing auto popover + list:

    1. If popover is endpoint, then set foundEndpoint to @@ -84570,18 +84571,18 @@ dictionary DragEventInit : MouseEventInit {

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

      + document's showing auto popover list is not empty:

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

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

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

    5. +
    6. 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.

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

    From 6272f47f70b4c2cd9b951df10e57879dea94ef5b Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 21 Dec 2023 15:38:09 -0800 Subject: [PATCH 03/36] Allow a stack of popover=hint popovers https://chromium-review.googlesource.com/c/chromium/src/+/5133909 --- source | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 12 deletions(-) diff --git a/source b/source index fbcfd8b19ed..a6573c63438 100644 --- a/source +++ b/source @@ -84078,9 +84078,6 @@ dictionary DragEventInit : MouseEventInit {

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

    -

    Every Document has a showing hint popover, which is an HTML element or null, initially null.

    -

    Every HTML element has a popover invoker, which is an HTML element or null, initially set to null.

    @@ -84185,6 +84182,54 @@ dictionary DragEventInit : MouseEventInit {
  • Let shouldRestoreFocus be false.

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

  • + +
  • +

    If originalType is the auto state, + then:

    + +
      +
    1. Run close entire popover list given document's showing + auto popover list.

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

    4. + +
    5. Run hide all popovers until given ancestor, false, and not + nestedShow.

    6. +
    +
  • + +
  • +

    Otherwise, if originalType is the hint state, then:

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

    2. + +
    3. +

      If ancestor is not null, then:

      + +
        +
      1. Run hide all popovers until given ancestor, false, and not + nestedShow.

      2. +
      +
    4. + +
    5. +

      Otherwise:

      + +
    6. TODO apparently we can append to the auto stack in this case???

    7. + +
    +
  • + + +
  • If element's popover attribute is in the auto state or DragEventInit : MouseEventInit {

    1. Run hide all popovers until given - element, focusPreviousElement, fireEvents, and false.

    2. + element, focusPreviousElement, and fireEvents.

    3. If the result of running check popover validity given element, @@ -84483,8 +84528,7 @@ dictionary DragEventInit : MouseEventInit {

      To hide all popovers until, given an HTML element or Document endpoint, a boolean - focusPreviousElement, a boolean fireEvents, and a boolean - hideUnrelatedPopovers:

      + focusPreviousElement, and a boolean fireEvents:

      1. Let document be endpoint's node document.

      2. @@ -84600,12 +84644,12 @@ dictionary DragEventInit : MouseEventInit {

        To hide all popovers, given a Document document, run hide all popovers until given document, - false, false, and true.

        + false, and false.

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

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

        The topmost popover ancestor algorithm will return the topmost (latest in the @@ -84712,11 +84756,14 @@ dictionary DragEventInit : MouseEventInit {

      3. 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. @@ -84831,6 +84878,22 @@ dictionary DragEventInit : MouseEventInit {
      5. 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: if element's popover attribute is in the hint state and element's popover + visibility state is showing, then append element to popovers.

      4. + +
      5. Return popovers.

      6. +
      +

      The popover target attributes

      Buttons may have the following content attributes:

      @@ -85025,7 +85088,7 @@ dictionary DragEventInit : MouseEventInit { document.

    4. If sameTarget is true, then run hide - all popovers until given ancestor, false, true, and true.

    5. + all popovers until given ancestor, false, and true.

  • From df9d56b13f350ddaeccb8b167a40b8447e857f53 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Tue, 9 Jan 2024 13:26:15 -0800 Subject: [PATCH 04/36] implemented hide --- source | 157 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 77 insertions(+), 80 deletions(-) diff --git a/source b/source index a6573c63438..94f846f6c71 100644 --- a/source +++ b/source @@ -84078,6 +84078,14 @@ dictionary DragEventInit : MouseEventInit {

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

    +

    TODO make sure that ever reference to these lists is implemented

    + +

    Every Document has a showing auto popover list, + which is a list, initially « ».

    + +

    Every Document has a showing hint popover list, which is a + list, initially « ».

    +

    Every HTML element has a popover invoker, which is an HTML element or null, initially set to null.

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

  • +
  • Let fireEvents be not nestedShow.

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

  • @@ -84185,83 +84195,84 @@ dictionary DragEventInit : MouseEventInit {
  • Let originalType be the value 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, and invoker.

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

  • +
  • If originalType is the auto state, then:

    1. Run close entire popover list given document's showing - auto popover list.

    2. + auto popover list, shouldRestoreFocus, and fireEvents.

      -
    3. Let ancestor be the result of running the topmost popover - ancestor algorithm given element, document's showing auto - popover list, and invoker.

    4. +
    5. Let ancestor be autoAncestor if autoAncestor is not + null, otherwise document.

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

    8. +
    9. Run hide all popovers until given ancestor, + shouldRestoreFocus, and fireEvents.

    10. + +
    11. Set stackToAppendTo to document's showing auto popover + list.

  • -

    Otherwise, if originalType is the hint state, then:

    +

    If originalType is the hint state, + then:

      -
    1. Let ancestor be the result of running the topmost popover - ancestor algorithm given element, document's showing hint - popover list, and invoker.

    2. -
    3. -

      If ancestor is not null, then:

      +

      If hintAncestor is not null, then:

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

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

      4. + +
      5. Set stackToAppendTo to document's showing hint popover + list

    4. - +
    5. Otherwise:

      -
    6. TODO apparently we can append to the auto stack in this case???

    7. - -
    -
  • - - - -
  • -

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

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

    2. - -
    3. Let ancestor be the result of running the topmost popover - ancestor algorithm given element and invoker.

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

      2. -
      3. If ancestor is null, then set ancestor to - document.

      4. +
      5. +

        If autoAncestor is not null, then:

        -
      6. -

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

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

        2. -
            -
          1. If document's showing hint popover is not null, then run the - hide popover algorithm given document's showing hint - popover, false, not nestedShow, and throwExceptions.

          2. +
          3. Set stackToAppendTo to document's showing auto popover + list.

          4. +
          + -
        3. If ancestor is not document, then run hide all popovers until given ancestor, - false, and not nestedShow.

        4. +
        5. Otherwise, set stackToAppendTo to document's showing hint + popover list

      7. +
      + -
    5. Otherwise, run hide all popovers until - given ancestor, false, and not nestedShow.

    6. +
    7. +

      If originalType is data-x="attr-popover-auto-state">auto or hint, then:

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

      2. If originalType is not equal to the value of element's popover attribute, then throw a @@ -84280,13 +84291,18 @@ dictionary 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. Assert: stackToAppendTo does not contain + element.

      6. + +
      7. Append element to stackToAppendTo.

      8. +
      9. Set element's popover close watcher to the result of establishing a close watcher given @@ -84304,10 +84320,6 @@ dictionary DragEventInit : MouseEventInit {

    8. -
    9. If element's popover attribute is in the - hint state, then set document's - showing hint popover to element.

    10. -
    11. Set element's previously focused element to null.

    12. Let originallyFocusedElement be document's focused area of the @@ -84862,36 +84874,21 @@ dictionary DragEventInit : MouseEventInit {

    13. Return true.

    -

    To get the showing auto popover list for a - Document document:

    - -
      -
    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. Return popovers.

    6. -
    - -

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

    +

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

      -
    1. Let popovers be « ».

    2. +
    3. +

      While popoverList is not empty:

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

    5. +
        +
      1. TODO: If a popover's beforetoggle handler opens a new popover, it is possible to get an + infinite loop here. Need to break that loop.

      2. -
      3. Return popovers.

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

      6. +
      +

    The popover target attributes

    From 7799dd8b61965358810448e3a47be0bf3926be9d Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 10 Jan 2024 15:36:21 -0800 Subject: [PATCH 05/36] did close entire popover stack --- source | 125 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 68 insertions(+), 57 deletions(-) diff --git a/source b/source index 94f846f6c71..3587047d619 100644 --- a/source +++ b/source @@ -84545,100 +84545,87 @@ dictionary DragEventInit : MouseEventInit {
    1. Let document be endpoint's node document.

    2. +
    3. Assert: endpoint is a Document or endpoint + is in the showing state.

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

    6. +
    7. -

      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 auto + popover list, focusPreviousElement, and fireEvents.

      4. -
      5. -

        While popover is not null:

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

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

        4. -
        5. Set popover to document's topmost auto - popover.

        6. -
        -
      6. +
      7. Return.

    8. -
    9. If endpoint is a Document, then run - closeAllOpenPopovers and return.

    10. - -
    11. Assert: endpoint's popover - attribute is not in the manual state.

    12. -
    13. -

      If endpoint's popover attribute is in the - hint state, then:

      +

      To findLastToHide, given an HTML element + endpoint and a list popoverList:

        +
      1. Let lastToHide be null.

      2. +
      3. -

        If hideUnrelatedPopovers is true, then:

        +

        For each popover in popoverList:

          -
        1. If document's showing hint popover is not null and - document's showing hint popover is not endpoint, then run - the hide popover algorithm given focusPreviousElement, - fireEvents, and throwExceptions.

        2. - -
        3. While document's showing auto popover list is not empty, run - the hide popover algorithm given focusPreviousElement, - fireEvents, and throwExceptions.

        4. +
        5. If popover is endpoint, then return + lastToHide.

        6. + +
        7. Set lastToHide to popover.

      4. + +
      5. Assert: This should never be reached.

    14. -

      Otherwise:

      +

      to hideStackUntil, given an showing:

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

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

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

      6. +
      7. Run the hide popover algorith given the last item in + popoverList, focusPreviousElement, fireEvents, and + false.

    15. -
    16. If foundEndpoint is false, then run closeAllOpenPopovers and - return.

    17. - -
    18. -

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

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

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

      2. -
      - - -
    21. 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.

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

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

    @@ -84647,6 +84634,30 @@ dictionary DragEventInit : MouseEventInit {
  • + +
  • +

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

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

    2. + +
    3. Run hideStackUntil given endpoint and document's + showing hint popover list.

    4. + +
    5. Return.

    6. +
    +
  • + +
  • Run closeEntirePopoverStack given document's showing popover + hint list, focusPreviousElement, and fireEvents.

  • + +
  • Assert: document's showing popover auto list contains + endpoint.

  • + +
  • Run hideStackUntil given endpoint and document's + showing popover auto list.

  • The hide all popovers until From 6419895954813fc4740880af5f1eb9f0e2a35281 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 11 Jan 2024 16:31:54 -0800 Subject: [PATCH 06/36] done, now to double check everything --- source | 52 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/source b/source index 3587047d619..4394796e8bc 100644 --- a/source +++ b/source @@ -84670,9 +84670,9 @@ dictionary DragEventInit : MouseEventInit { false, and false.

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

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

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

  • Let document be newPopover's node document.

  • -

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

    +

    For each popover of popoverList:

    1. Set popoverPositions[popover] to @@ -84732,10 +84731,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. If candidateAncestor is null, then return.

      8. +
      9. Let candidateAncestor be null.

      10. + +
      11. +

        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. Assert: candidateAncestor's popover attribute is not in the manual or none state.

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

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

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

      13. @@ -85119,11 +85143,17 @@ dictionary DragEventInit : MouseEventInit { an HTML element popover:

          -
        1. Let popoverList be popover's node document's +

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

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

        5. -
        6. If popover is in popoverList, then return the index of - popover in popoverList + 1.

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

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

        11. Return 0.

        From 3ced123cce8fafc0508aae16c23bd940444ced05 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 26 Jan 2024 14:40:13 -0800 Subject: [PATCH 07/36] something --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index 4394796e8bc..67d12de7685 100644 --- a/source +++ b/source @@ -84599,7 +84599,7 @@ dictionary DragEventInit : MouseEventInit {
      14. Perform the following steps at least once:

        - +
        1. Let lastToHide be the result of running findLastToHide given endpoint and popoverList.

        2. From f0ca5514ba8d6919afa79a19e3e3ec6f98d047a8 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 8 Feb 2024 11:19:53 -0800 Subject: [PATCH 08/36] add opened in mode --- source | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/source b/source index 67d12de7685..618cd797f1f 100644 --- a/source +++ b/source @@ -84078,14 +84078,6 @@ dictionary DragEventInit : MouseEventInit {

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

          -

          TODO make sure that ever reference to these lists is implemented

          - -

          Every Document has a showing auto popover list, - which is a list, initially « ».

          - -

          Every Document has a showing hint popover list, which is a - list, initially « ».

          -

          Every HTML element has a popover invoker, which is an HTML element or null, initially set to null.

          @@ -84098,6 +84090,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 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:

          From 74a3a818aa87ffd3f1b0513663fbe1797456745c Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 8 Feb 2024 12:26:36 -0800 Subject: [PATCH 09/36] fix and compiles --- source | 118 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 37 deletions(-) diff --git a/source b/source index 9f44da2b6c3..f66b40f2278 100644 --- a/source +++ b/source @@ -84462,11 +84462,10 @@ dictionary DragEventInit : MouseEventInit {
        3. Let ancestor be autoAncestor if autoAncestor is not null, otherwise document.

        4. -
        5. Run hide all popovers until given ancestor, - shouldRestoreFocus, and fireEvents.

        6. +
        7. Run hide all popovers until given + ancestor, shouldRestoreFocus, and fireEvents.

        8. -
        9. Set stackToAppendTo to document's showing auto popover - list.

        10. +
        11. Set stackToAppendTo to "auto".

      15. @@ -84479,11 +84478,10 @@ dictionary DragEventInit : MouseEventInit {

        If hintAncestor is not null, then:

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

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

        4. -
        5. Set stackToAppendTo to document's showing hint popover - list

        6. +
        7. Set stackToAppendTo to "hint".

      16. @@ -84498,23 +84496,21 @@ dictionary DragEventInit : MouseEventInit {

        If autoAncestor is not null, then:

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

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

        4. -
        5. Set stackToAppendTo to document's showing auto popover - list.

        6. +
        7. Set stackToAppendTo to "auto".

        -
      17. Otherwise, set stackToAppendTo to document's showing hint - popover list

      18. +
      19. Otherwise, set stackToAppendTo to "hint".

  • -

    If originalType is data-x="attr-popover-auto-state">auto or If originalType is auto or hint, then:

      @@ -84537,17 +84533,38 @@ dictionary DragEventInit : MouseEventInit {
    1. -

      If the result of running topmost auto or hint 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.

    2. -
    3. Assert: stackToAppendTo does not contain - element.

    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 mode to "auto".

      4. +
      + +

      Otherwise:

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

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

      4. -
      5. Append element to stackToAppendTo.

      6. +
      7. Set element's opened in mode to "hint".

      8. +
      +
    6. Set element's popover close watcher to the result of DragEventInit : MouseEventInit {

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

    8. -
    9. Set document's showing hint popover to null.

    10. +
    11. Set element's opened in mode to null.

    12. Set element's popover visibility state to hidden.

    13. @@ -84810,18 +84827,18 @@ dictionary DragEventInit : MouseEventInit {
    14. 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.

    15. If endpoint is a Document:

        -
      1. Run close entire popover list given document's auto - popover list, focusPreviousElement, and fireEvents.

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

      4. -
      5. Run close entire popover list given document's hint - popover list, focusPreviousElement, and fireEvents.

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

      8. Return.

      @@ -84850,7 +84867,7 @@ dictionary DragEventInit : MouseEventInit {
    16. -

      to hideStackUntil, given an HTML element element and a list popoverList

        @@ -84873,7 +84890,7 @@ dictionary DragEventInit : MouseEventInit {
        1. Assert: popoverList is not empty.

        2. -
        3. Run the hide popover algorith given the last item in +

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

        @@ -84895,7 +84912,7 @@ dictionary DragEventInit : MouseEventInit {
      1. -

        If document's showing popover hint list contains +

        If document's showing hint popover list contains endpoint:

          @@ -84909,14 +84926,14 @@ dictionary DragEventInit : MouseEventInit {
      2. -
      3. Run closeEntirePopoverStack given document's showing popover - hint list, focusPreviousElement, and fireEvents.

      4. +
      5. Run closeEntirePopoverStack given document's showing hint + popover list, focusPreviousElement, and fireEvents.

      6. -
      7. Assert: document's showing popover auto list contains +

      8. Assert: document's showing auto popover list contains endpoint.

      9. Run hideStackUntil given endpoint and document's - showing popover auto list.

      10. + showing auto popover list.

      The hide all popovers until @@ -84929,7 +84946,7 @@ dictionary DragEventInit : MouseEventInit { false, and false.

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

      @@ -85168,6 +85185,36 @@ dictionary DragEventInit : MouseEventInit {
    17. Return true.

    +

    To get the showing auto popover list for a + Document document + +

      +
    1. Let popovers be « ».

    2. + +
    3. For each Element element in + document's top layer: if element's opened in mode + is "auto" and element's popover visibility state + is showing, then append element to popovers.

    4. + +
    5. Return popovers.

    6. +
    + +

    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: if element's opened in mode + is "hint" and element's popover visibility state + is showing, then append element to popovers.

    4. + +
    5. Return popovers.

    6. +
    +

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

    @@ -85176,9 +85223,6 @@ dictionary DragEventInit : MouseEventInit {

    While popoverList is not empty:

      -
    1. TODO: If a popover's beforetoggle handler opens a new popover, it is possible to get an - infinite loop here. Need to break that loop.

    2. -
    3. Run the hide popover algorithm given popoverList's last item, focusPreviousElement, fireEvents, and false.

    From 2274825ba6ba0a516fbf7b2cc1399e60870d4f0a Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 8 Feb 2024 12:35:24 -0800 Subject: [PATCH 10/36] add missing closing angle bracket --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index f66b40f2278..f52f5ea9572 100644 --- a/source +++ b/source @@ -84868,7 +84868,7 @@ dictionary DragEventInit : MouseEventInit {
  • to hideStackUntil, given an HTML element - element and a list popoverList + element and a list popoverList:

    1. Let repeatingHide be false.

    2. From a85d2a77a126a980d59202e6cd9998e74b01f20a Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 8 Feb 2024 12:41:02 -0800 Subject: [PATCH 11/36] another one --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index f52f5ea9572..f224ac3188b 100644 --- a/source +++ b/source @@ -85186,7 +85186,7 @@ dictionary DragEventInit : MouseEventInit {

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

    1. Let popovers be « ».

    2. From 5e2f41bbf066f2de0165909327b793c0a0a4d9d2 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 9 Feb 2024 12:31:34 -0800 Subject: [PATCH 12/36] fix dd --- source | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source b/source index f224ac3188b..04ce94cd792 100644 --- a/source +++ b/source @@ -84299,8 +84299,9 @@ dictionary DragEventInit : MouseEventInit { hint hint - Closes other hint popovers when opened; has light - dismiss; only one can be open at a time. + Closes other hint popovers when opened, but not other auto popovers; has light dismiss; responds to close requests. From bb6baf651c6cb7390c50c29830cd0500d884c23d Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 9 Feb 2024 12:33:06 -0800 Subject: [PATCH 13/36] rename opened in mode --- source | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source b/source index 04ce94cd792..fd946fb608a 100644 --- a/source +++ b/source @@ -84342,8 +84342,8 @@ 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 mode, which - is a string 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, @@ -84549,7 +84549,7 @@ dictionary DragEventInit : MouseEventInit {

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

    4. -
    5. Set element's opened in mode to "

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

    @@ -84562,7 +84562,7 @@ dictionary DragEventInit : MouseEventInit {
  • Assert: document's showing hint popover list does not contain element.

  • -
  • Set element's opened in mode to "

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

  • @@ -84753,7 +84753,7 @@ dictionary DragEventInit : MouseEventInit {
  • Otherwise, remove an element from the top layer immediately given element.

  • -
  • Set element's opened in mode to null.

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

  • Set element's popover visibility state to hidden.

  • @@ -85193,9 +85193,9 @@ dictionary DragEventInit : MouseEventInit {
  • Let popovers be « ».

  • For each Element element in - document's top layer: if element's opened in mode - is "auto" and element's popover visibility state - is showing, then auto" and element's popover visibility + state is showing, then append element to popovers.

  • Return popovers.

  • @@ -85208,9 +85208,9 @@ dictionary DragEventInit : MouseEventInit {
  • Let popovers be « ».

  • For each Element element in - document's top layer: if element's opened in mode - is "hint" and element's popover visibility state - is showing, then hint" and element's popover visibility + state is showing, then append element to popovers.

  • Return popovers.

  • From 8027c1f6ee62a0314d32c94c2481694a0ed98528 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 9 Feb 2024 12:36:04 -0800 Subject: [PATCH 14/36] auto->hint --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index fd946fb608a..4fba80cf0e6 100644 --- a/source +++ b/source @@ -84458,7 +84458,7 @@ dictionary DragEventInit : MouseEventInit {
    1. Run close entire popover list given document's showing - auto popover list, shouldRestoreFocus, and fireEvents.

    2. + hint popover list, shouldRestoreFocus, and fireEvents.

    3. Let ancestor be autoAncestor if autoAncestor is not null, otherwise document.

    4. From 03d545f76b4cefd706bf67134256998b297c863e Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 9 Feb 2024 12:36:59 -0800 Subject: [PATCH 15/36] span->hint --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index 4fba80cf0e6..db2e80760fb 100644 --- a/source +++ b/source @@ -84557,7 +84557,7 @@ dictionary DragEventInit : MouseEventInit {
      1. Assert: stackToAppendTo is "span".

      2. + data-x="">hint
        ".

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

      4. From 6e2e5821a8ae2783d32dc83162b9c855ce380186 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 9 Feb 2024 12:41:32 -0800 Subject: [PATCH 16/36] close hints first --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index db2e80760fb..bff23010f38 100644 --- a/source +++ b/source @@ -84836,10 +84836,10 @@ dictionary DragEventInit : MouseEventInit {
        1. Run close entire popover list given document's showing - auto popover list, focusPreviousElement, and fireEvents.

        2. + hint popover list, focusPreviousElement, and fireEvents.

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

        4. + auto popover list, focusPreviousElement, and fireEvents.

        5. Return.

        From e1fe43f1b493f35af0357b1528ba713fbe384e7d Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 20 Mar 2024 16:20:15 -0700 Subject: [PATCH 17/36] match phrasing --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index bff23010f38..b31bdd40e55 100644 --- a/source +++ b/source @@ -84300,7 +84300,7 @@ dictionary DragEventInit : MouseEventInit { data-x="attr-popover-hint">hint
        hint Closes other hint popovers when opened, but not other auto popovers; has light dismiss; responds to light dismiss and responds to close requests. From f2369dcb46907b219c6d3476b6c16cbdd8cf5a6c Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 20 Mar 2024 16:21:06 -0700 Subject: [PATCH 18/36] boolean negation --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index b31bdd40e55..917c81006a6 100644 --- a/source +++ b/source @@ -84406,7 +84406,7 @@ dictionary DragEventInit : MouseEventInit {
      5. Let nestedShow be element's popover showing or hiding.

      6. -
      7. Let fireEvents be not nestedShow.

      8. +
      9. Let fireEvents be the boolean negation of nestedShow.

      10. Set element's popover showing or hiding to true.

      11. From 6ac157f5f74744c3e16e1af09c3fdea139ba339b Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 20 Mar 2024 16:26:34 -0700 Subject: [PATCH 19/36] fix nits --- source | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source b/source index 917c81006a6..8a9afd46d23 100644 --- a/source +++ b/source @@ -84439,7 +84439,7 @@ dictionary DragEventInit : MouseEventInit {
      12. Let shouldRestoreFocus be false.

      13. -
      14. Let originalType be the value of element's

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

      15. Let stackToAppendTo be null.

      16. @@ -84468,7 +84468,7 @@ dictionary DragEventInit : MouseEventInit {
      17. Set stackToAppendTo to "auto".

      -
    5. +
    6. If originalType is the hint state, @@ -84517,8 +84517,8 @@ dictionary DragEventInit : MouseEventInit {

      1. Assert: stackToAppendTo is not null.

      2. -
      3. If originalType is not equal to the value of element's popover attribute, then throw a +

      4. If originalType is not equal to the current state of element's + popover attribute, then throw a "InvalidStateError" DOMException.

      5. From 2105d6b1e0653933e7ce93974b29beac91fe9ad6 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 20 Mar 2024 16:43:02 -0700 Subject: [PATCH 20/36] inline lasttohide, and nits --- source | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/source b/source index 8a9afd46d23..f8944766231 100644 --- a/source +++ b/source @@ -84553,7 +84553,9 @@ dictionary DragEventInit : MouseEventInit { data-x="">auto".

      -

      Otherwise:

      +
    7. +

      Otherwise:

      +
      1. Assert: stackToAppendTo is "DragEventInit : MouseEventInit {

      2. Let document be endpoint's node document.

      3. -
      4. Assert: endpoint is a Document or endpoint - is in the showing state.

      5. +
      6. Assert: endpoint is a Document or + endpoint's popover visibility state is showing.

      7. Assert: endpoint is a Document or endpoint's popover attribute is in the DragEventInit : MouseEventInit {

      -
    8. -

      To findLastToHide, given an HTML element - endpoint and a list popoverList:

      - -
        -
      1. Let lastToHide be null.

      2. - -
      3. -

        For each popover in popoverList:

        - -
          -
        1. If popover is endpoint, then return - lastToHide.

        2. - -
        3. Set lastToHide to popover.

        4. -
        -
      4. - -
      5. Assert: This should never be reached.

      6. -
      -
    9. -
    10. to hideStackUntil, given an HTML element element and a list popoverList:

      @@ -84878,8 +84859,17 @@ dictionary DragEventInit : MouseEventInit {

      Perform the following steps at least once:

        -
      1. Let lastToHide be the result of running findLastToHide given - endpoint and popoverList.

      2. +
      3. Let lastToHide be null.

      4. + +
      5. +

        For each popover in popoverList + +

          +
        1. If popover is endpoint, then break.

        2. + +
        3. Set lastToHide to popover.

        4. +
        +
      6. If lastToHide is null, then return.

      7. From 8807dd57bf924a0131fb1af5add9b629cfafb25c Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 20 Mar 2024 16:44:26 -0700 Subject: [PATCH 21/36] remove duplicate the --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index f8944766231..c27af2a15c8 100644 --- a/source +++ b/source @@ -84439,7 +84439,7 @@ dictionary DragEventInit : MouseEventInit {
      8. Let shouldRestoreFocus be false.

      9. -
      10. Let originalType be the the current state of element's

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

      11. Let stackToAppendTo be null.

      12. From e637dacd09da0c81c38c83f379d12787041e114c Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 20 Mar 2024 17:01:33 -0700 Subject: [PATCH 22/36] fix reference and fix lambda syntax --- source | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source b/source index c27af2a15c8..dcada555134 100644 --- a/source +++ b/source @@ -84849,8 +84849,9 @@ dictionary DragEventInit : MouseEventInit {
      13. -

        to hideStackUntil, given an HTML element - element and a list popoverList:

        +

        Let hideStackUntil be the following steps given an HTML element element and a list + popoverList:

        1. Let repeatingHide be false.

        2. @@ -84917,7 +84918,7 @@ dictionary DragEventInit : MouseEventInit {
      14. -
      15. Run closeEntirePopoverStack given document's showing hint +

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

      17. Assert: document's showing auto popover list contains From 43705d2bbc3af1292efbb6244050ad6cd87762f8 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 4 Apr 2024 15:58:19 -0700 Subject: [PATCH 23/36] remove li wrapping p --- source | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source b/source index 4321fc059d3..6812b4630e5 100644 --- a/source +++ b/source @@ -84887,9 +84887,7 @@ dictionary DragEventInit : MouseEventInit { data-x="">auto".

      -
    11. -

      Otherwise:

      -
    12. +

      Otherwise:

      1. Assert: stackToAppendTo is " Date: Thu, 4 Apr 2024 16:04:05 -0700 Subject: [PATCH 24/36] some nits --- source | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source b/source index 6812b4630e5..708d52b49fc 100644 --- a/source +++ b/source @@ -85195,7 +85195,7 @@ dictionary DragEventInit : MouseEventInit {

      2. Let lastToHide be null.

      3. -

        For each popover in popoverList +

        For each popover in popoverList:

        1. If popover is endpoint, then break.

        2. @@ -85207,8 +85207,7 @@ dictionary DragEventInit : MouseEventInit {
        3. If lastToHide is null, then return.

        4. -

          While lastToHide is not null and lastToHide's - popover visibility state is While lastToHide's popover visibility state is showing:

            From e9f877d11d45c1ce2e4359f714d07d04e56f8bf3 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 4 Apr 2024 16:22:06 -0700 Subject: [PATCH 25/36] if all of the following are true --- source | 56 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/source b/source index 708d52b49fc..541744908b5 100644 --- a/source +++ b/source @@ -85514,11 +85514,29 @@ dictionary DragEventInit : MouseEventInit {
            1. Let popovers be « ».

            2. -
            3. For each Element element in - document's top layer: if element's opened in popover - mode is "auto" 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:

                + +
                  +
                1. element is an HTML element;

                2. + +
                3. element's opened in popover mode is "auto"; and

                4. + +
                5. element's popover visibility state is showing, +

                +
              2. + +
              3. then append element to + popovers.

              4. +
              +
            6. Return popovers.

            @@ -85529,11 +85547,29 @@ dictionary DragEventInit : MouseEventInit {
            1. Let popovers be « ».

            2. -
            3. For each Element element in - document's top layer: if element's opened in popover - mode is "hint" 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:

                + +
                  +
                1. element is an HTML element;

                2. + +
                3. element's opened in popover mode is "hint"; and

                4. + +
                5. element's popover visibility state is showing, +

                +
              2. + +
              3. then append element to + popovers.

              4. +
              +
            6. Return popovers.

            From 7848e393e72cf0ef741f499b32a2c2935664a596 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 19 Apr 2024 11:39:58 -0700 Subject: [PATCH 26/36] fix dialog topmost popover ancestor calls --- source | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/source b/source index 63ddaaf6ee5..0bb06f462c9 100644 --- a/source +++ b/source @@ -61347,11 +61347,18 @@ interface HTMLDialogElement : HTMLElement {
          1. Set this's previously focused element to the focused element.

          2. +
          3. Let document be this's node document.

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

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

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

          8. +
          9. 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.

          10. + +
          11. If hideUntil is null, then set hideUntil to + document.

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

          13. @@ -61416,11 +61423,18 @@ interface HTMLDialogElement : HTMLElement {
          14. Set this's previously focused element to the focused element.

          15. +
          16. Let document be this's node document.

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

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

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

          21. +
          22. 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.

          23. + +
          24. If hideUntil is null, then set hideUntil to + document.

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

          26. From e7b26501b6a8f7da2d8f6485220d8832b4a8f1ac Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 19 Apr 2024 12:12:55 -0700 Subject: [PATCH 27/36] fix if all the following are true --- source | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source b/source index 0bb06f462c9..7f7a0b624e5 100644 --- a/source +++ b/source @@ -85711,7 +85711,7 @@ dictionary DragEventInit : MouseEventInit {
          27. If all of the following are true:

            -
              +
              • element is an HTML element;

              • element's opened in popover mode is "DragEventInit : MouseEventInit {

              • element's popover visibility state is showing, -

            -
          28. -
          29. then append element to - popovers.

          30. +
          31. then append element to + popovers.

          32. + +
        5. @@ -85744,7 +85744,7 @@ dictionary DragEventInit : MouseEventInit {
        6. If all of the following are true:

          -
            +
            • element is an HTML element;

            • element's opened in popover mode is "DragEventInit : MouseEventInit {

            • element's popover visibility state is showing, -

          -
        7. -
        8. then append element to - popovers.

        9. +
        10. then append element to + popovers.

        11. + +
      4. From ab414b715dfe9140b727c35c77a9d9445d92570e Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 19 Apr 2024 12:20:18 -0700 Subject: [PATCH 28/36] un-inline getStackPosition --- source | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/source b/source index 7f7a0b624e5..0dc050fdf1f 100644 --- a/source +++ b/source @@ -85990,32 +85990,30 @@ 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 running get the popover stack position given + clickedPopover is greater than the result of running get the popover stack + position given invokerPopover, then return clickedPopover.

      9. -
          -
        1. Let hintList be popover's node document's - showing hint popover list.

        2. +
        3. Return invokerPopover.

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

      11. +

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

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

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

        2. -
        3. If popover is in autoList, then return the index of - popover in autoList + 1.

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

        6. -
        7. Return 0.

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

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

      17. +
      18. If popover is in autoList, then return the index of + popover in autoList + 1.

      19. -
      20. Return invokerPopover.

      21. +
      22. Return 0.

      To find the nearest inclusive target popover for invoker given a Node From d8a134bd69c077bd2fb0f38fcdbb697b44207b70 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 22 Apr 2024 10:55:06 -0700 Subject: [PATCH 29/36] un-inline hideStackUntil --- source | 103 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/source b/source index 0dc050fdf1f..4b64e0cd095 100644 --- a/source +++ b/source @@ -85342,82 +85342,79 @@ dictionary DragEventInit : MouseEventInit {

    13. -

      Let hideStackUntil be the following steps given an HTML element element and a list - popoverList:

      +

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

        -
      1. Let repeatingHide be false.

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

      4. -
      5. -

        Perform the following steps at least once:

        +
      6. Run hide popover stack until given endpoint and + document's showing hint popover list.

      7. -
          -
        1. Let lastToHide be null.

        2. +
        3. Return.

        4. +
        + -
      8. -

        For each popover in popoverList:

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

      10. -
          -
        1. If popover is endpoint, then break.

        2. +
        3. Assert: document's showing auto popover list contains + endpoint.

        4. -
        5. Set lastToHide to popover.

        6. -
        - +
      11. Run hide popover stack until given endpoint and + document's showing auto popover list.

      12. +
      -
    14. If lastToHide is null, then return.

    15. +

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

      -
    16. -

      While lastToHide's popover visibility state is showing:

      +
        +
      1. Let repeatingHide be false.

      2. -
          -
        1. Assert: popoverList is not empty.

        2. +
        3. +

          Perform the following steps at least once:

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

        5. -
        - +
          +
        1. Let lastToHide be null.

        2. -
        3. Assert: repeatingHide is false or popoverList's - last item is endpoint.

        4. +
        5. +

          For each popover in popoverList:

          -
        6. Set repeatingHide to true if popoverList contains - endpoint and popoverList's last item is not endpoint, - otherwise false.

        7. +
            +
          1. If popover is endpoint, then break.

          2. -
          3. If repeatingHide is true, then set fireEvents to false.

          4. +
          5. Set lastToHide to popover.

          - -

          and keep performing them while repeatingHide is true.

          -
        - -
      3. -

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

        +
      4. If lastToHide is null, then return.

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

        2. +
        3. +

          While lastToHide's popover visibility state is showing:

          -
        4. Run hideStackUntil given endpoint and document's - showing hint popover list.

        5. +
            +
          1. Assert: popoverList is not empty.

          2. -
          3. Return.

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

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

      7. +
      8. Assert: repeatingHide is false or popoverList's + last item is endpoint.

      9. -
      10. Assert: document's showing auto popover list contains - endpoint.

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

      13. -
      14. Run hideStackUntil given endpoint and document's - showing auto popover list.

      15. +
      16. If repeatingHide is true, then set fireEvents to false.

      17. +
      + +

      and keep performing them while repeatingHide is true.

      +

    The hide all popovers until From 579f2e1e6898b837316c338716062b3b3736f5d9 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 22 Apr 2024 10:57:56 -0700 Subject: [PATCH 30/36] remove li in last step of if all the following are true --- source | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source b/source index 4b64e0cd095..174b5473a1a 100644 --- a/source +++ b/source @@ -85717,8 +85717,8 @@ dictionary DragEventInit : MouseEventInit {

  • element's popover visibility state is showing, -

  • then append element to - popovers.

  • +

    then append element to + popovers.

    @@ -85750,8 +85750,8 @@ dictionary DragEventInit : MouseEventInit {
  • element's popover visibility state is showing, -

  • then append element to - popovers.

  • +

    then append element to + popovers.

    From ed9e6c57a42c01c3dcc3aac002032b8d862f614c Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 22 Apr 2024 11:00:37 -0700 Subject: [PATCH 31/36] remove running x2 --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 174b5473a1a..6ee7ad4011f 100644 --- a/source +++ b/source @@ -85987,8 +85987,8 @@ dictionary DragEventInit : MouseEventInit {
  • Let invokerPopover be the result of running nearest inclusive target popover for invoker given node.

  • -
  • If the result of running get the popover stack position given - clickedPopover is greater than the result of running get the popover stack +

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

  • Return invokerPopover.

  • From a8508b989fea7126e3028fe3e3d1bb2b771b1bf3 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Thu, 25 Apr 2024 09:05:45 -0700 Subject: [PATCH 32/36] fix grammar --- source | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source b/source index 6ee7ad4011f..4cbd332d9d8 100644 --- a/source +++ b/source @@ -85987,9 +85987,10 @@ dictionary DragEventInit : MouseEventInit {
  • Let invokerPopover be the result of running nearest inclusive target popover for invoker given node.

  • -
  • If the result of get the popover stack position given - clickedPopover is greater than the result of get the popover stack - position given invokerPopover, then return clickedPopover.

  • +
  • 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.

  • Return invokerPopover.

  • From 6072e71f9323f4df2795c29fb6be1fd1ec64e453 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 5 Jun 2024 13:45:57 +0200 Subject: [PATCH 33/36] add focusPreviousElement and fireEvents to hide popover stack until --- source | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source b/source index 4cbd332d9d8..c5525834988 100644 --- a/source +++ b/source @@ -85349,8 +85349,9 @@ dictionary DragEventInit : MouseEventInit {
  • Assert: endpoint's popover attribute is in the hint state.

  • -
  • Run hide popover stack until given endpoint and - document's showing hint popover list.

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

  • Return.

  • @@ -85362,12 +85363,14 @@ dictionary DragEventInit : MouseEventInit {
  • Assert: document's showing auto popover list contains endpoint.

  • -
  • Run hide popover stack until given endpoint and - document's showing auto popover list.

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

  • To hide popover stack until, given an HTML - element element and a list popoverList:

    + element element, a list popoverList, a boolean + focusPreviousElement, and a boolean fireEvents:

    1. Let repeatingHide be false.

    2. From 3ab1cc30fe957515f1dafeeda7e4d194a1b1e0a3 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Tue, 10 Sep 2024 08:37:35 -0700 Subject: [PATCH 34/36] crrev.com/c/5848008 --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index c5525834988..06b5d27a3ef 100644 --- a/source +++ b/source @@ -85360,8 +85360,8 @@ dictionary DragEventInit : MouseEventInit {
    3. Run close entire popover list given document's showing hint popover list, focusPreviousElement, and fireEvents.

    4. -
    5. Assert: document's showing auto popover list contains - endpoint.

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

    8. Run hide popover stack until given endpoint, document's showing auto popover list, focusPreviousElement, and From aac88012ca127a3eb5d2a69b78488a2b757ca3e8 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 21 Oct 2024 14:42:40 +0900 Subject: [PATCH 35/36] Minor nits --- source | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source b/source index 9e70252ff45..ed1fc9078db 100644 --- a/source +++ b/source @@ -85810,7 +85810,7 @@ dictionary DragEventInit : MouseEventInit {

    9. Run hide popover stack until given endpoint, document's showing hint popover list, focusPreviousElement, - fireEvents.

    10. + and fireEvents.

    11. Return.

    @@ -86178,10 +86178,10 @@ dictionary DragEventInit : MouseEventInit {
  • element's popover visibility state is showing, - -

    then append element to - popovers.

    + +

    then append element to + popovers.

  • @@ -86211,10 +86211,10 @@ dictionary DragEventInit : MouseEventInit {
  • element's popover visibility state is showing, - -

    then append element to - popovers.

    + +

    then append element to + popovers.

  • From fcaf6024c83cdda75a02fa99a70d75b335a75ae6 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 21 Oct 2024 11:18:21 -0700 Subject: [PATCH 36/36] add missing isPopover argument --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index ed1fc9078db..8a71f1d0b5f 100644 --- a/source +++ b/source @@ -85383,11 +85383,11 @@ dictionary DragEventInit : MouseEventInit {
  • Let autoAncestor be the result of running the topmost popover ancestor algorithm given element, document's showing auto - popover list, and invoker.

  • + 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, and invoker.

  • + popover list, invoker, and true.

  • If originalType is the auto state,