From 573442ffe3b924b15f5e081cb53e3f72cb9d01af Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Wed, 31 Jan 2024 07:32:32 -0800 Subject: [PATCH] Allow top layer elements to be nested within popovers Fixes https://github.com/whatwg/html/issues/9998 Implemented in chromium here: https://chromium-review.googlesource.com/c/chromium/src/+/5229300 --- source | 61 ++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/source b/source index dffcc9efcd2..f87e8c8574e 100644 --- a/source +++ b/source @@ -61121,8 +61121,11 @@ interface HTMLDialogElement : HTMLElement {
  • Set this's previously focused element to the focused element.

  • -
  • Run hide all popovers given this's node - document.

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

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

  • Run the dialog focusing steps given this.

  • @@ -61184,8 +61187,11 @@ interface HTMLDialogElement : HTMLElement {
  • Set this's previously focused element to the focused element.

  • -
  • Run hide all popovers given this's node - document.

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

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

  • Run the dialog focusing steps given this.

  • @@ -84446,7 +84452,7 @@ dictionary DragEventInit : MouseEventInit { data-x="popover-showing-state">showing; otherwise false.

    -

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

    @@ -84538,10 +84544,10 @@ dictionary DragEventInit : MouseEventInit { hide all popovers until given document, 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.

    +

    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.

    The topmost popover ancestor algorithm will return the topmost (latest in the @@ -84569,11 +84575,38 @@ dictionary DragEventInit : MouseEventInit {

      +
    1. +

      If isPopover is true:

      + +
        +
      1. Assert: newPopoverOrTopLayerElement is an HTML element.

      2. + +
      3. Assert: newPopoverOrTopLayerElement's popover attribute is not in the no popover state or the manual state.

      4. + +
      5. Assert: newPopoverOrTopLayerElement's popover visibility + state is not in the popover showing + state.

      6. +
      +
    2. + +
    3. +

      Otherwise:

      + +
        +
      1. Assert: invoker is null.

      2. +
      +
    4. +
    5. Let popoverPositions be an empty ordered map.

    6. Let index be 0.

    7. -
    8. Let document be newPopover's node document.

    9. +
    10. Let document be newPopoverOrTopLayerElement's node + document.

    11. For each popover of document's showing auto popover @@ -84587,8 +84620,8 @@ dictionary DragEventInit : MouseEventInit {

    -
  • Set popoverPositions[newPopover] to - index.

  • +
  • If isPopover is true, then Set + popoverPositions[newPopoverOrTopLayerElement] to index.

  • Increment index by 1.

  • @@ -84616,8 +84649,8 @@ dictionary DragEventInit : MouseEventInit { -
  • Run checkAncestor given newPopover's parent node within the - flat tree.

  • +
  • Run checkAncestor given newPopoverOrTopLayerElement's parent node + within the flat tree.

  • Run checkAncestor given invoker.