From 44ca8747e5ed14e201e0c5964d7751b7ce0d8a30 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 18 Jan 2023 13:45:30 -0800 Subject: [PATCH 1/5] Add "check and possibly close popover stack" algorithm The "auto popover list" is constructed by attributes set on buttons. When those buttons are modified, it can break connections in the list. This patch adds checks to spots where buttons can be modified in order to fix up the list by closing all popovers when a connection has been broken. --- source | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/source b/source index c56d43c7b1e..42875b42fb2 100644 --- a/source +++ b/source @@ -1828,6 +1828,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • If removedNode's popover attribute is not in the no popover state, then run the hide popover algorithm given removedNode, false, false, and false.

  • + +
  • If removedNode is a button, then run + check and possibly close popover stack given removedNode's node + document.

  • A HTMLInputElement : HTMLElement { element's text entry cursor position to the beginning of the text control, and set its selection direction to "none".

    + +
  • Run check and possibly close popover stack given the element's node + document.

  • @@ -81861,6 +81868,10 @@ dictionary DragEventInit : MouseEventInit {
    1. If namespace is not null, then return.

    2. +
    3. If localName is disabled or form, then run check and possibly close popover stack + given element's node document.

    4. +
    5. If localName is not popover, then return.

    6. @@ -82411,6 +82422,35 @@ dictionary DragEventInit : MouseEventInit {
    7. Return true.

    +

    To check and possibly close popover stack for a Document + document:

    + +
      +
    1. Let stack be document's auto popover list.

    2. + +
    3. Let index stack's size - 1.

    4. + +
    5. +

      While index is greater than 0:

      + +
        +
      1. +

        If the result of running topmost popover ancestor given + stack[index] is not stack[index - 1], then:

        + +
          +
        1. Run hide all popovers until given + document, false, and false.

        2. + +
        3. Return.

        4. +
        +
      2. + +
      3. Set index to index - 1.

      4. +
      +
    6. +
    +

    The popover target attributes

    Buttons may have the following content attributes:

    From c683d72d277146c395633aac86caf13b2d467c0b Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Sat, 18 Mar 2023 11:42:22 -0700 Subject: [PATCH 2/5] add popovertarget change check --- source | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source b/source index 42875b42fb2..d5f467ac77e 100644 --- a/source +++ b/source @@ -81868,9 +81868,10 @@ dictionary DragEventInit : MouseEventInit {
    1. If namespace is not null, then return.

    2. -
    3. If localName is disabled or form, then run check and possibly close popover stack - given element's node document.

    4. +
    5. If localName is disabled, form, or popovertarget, + then run check and possibly close popover stack given element's + node document.

    6. If localName is not popover, then return.

    7. From df13f28d983bf78585710d4dd034236a88ba49d2 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Sun, 19 Mar 2023 22:29:01 -0700 Subject: [PATCH 3/5] fix attr-popovertarget --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index d5f467ac77e..b54cf2a712d 100644 --- a/source +++ b/source @@ -81869,7 +81869,7 @@ dictionary DragEventInit : MouseEventInit {
    8. If namespace is not null, then return.

    9. If localName is disabled, form, or popovertarget, + data-x="attr-fae-form">form, or popovertarget, then run check and possibly close popover stack given element's node document.

    10. From e1edb5d584006ae05278330368ae0dcdec92bd6d Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Sun, 19 Mar 2023 22:29:52 -0700 Subject: [PATCH 4/5] use hide all popovers --- source | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source b/source index b54cf2a712d..36423c21be5 100644 --- a/source +++ b/source @@ -82440,8 +82440,7 @@ dictionary DragEventInit : MouseEventInit { stack[index] is not stack[index - 1], then:

        -
      1. Run hide all popovers until given - document, false, and false.

      2. +
      3. Run hide all popovers given document.

      4. Return.

      From 7e2eb2af059c4c3c9e224224d7ae38f2555415f6 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 20 Mar 2023 17:29:35 -0700 Subject: [PATCH 5/5] add note --- source | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source b/source index 36423c21be5..e9030e7394e 100644 --- a/source +++ b/source @@ -82451,6 +82451,14 @@ dictionary DragEventInit : MouseEventInit {
    +
    +

    Check and possibly close popover stack is used to close multiple popovers which + are only open due to their ancestral relationship to each other in the case where that ancestral + relationship has been broken. Show popover also closes popovers which don't meet + this ancestral relationship by calling hide all popovers + until.

    +
    +

    The popover target attributes

    Buttons may have the following content attributes: