From 883112d83c6283263a12c4fa7bb17f7bf1902e17 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 10 Oct 2022 15:36:27 -0700 Subject: [PATCH] Add pop-up light dismiss logic to event dispatching This was moved from the HTML spec PR for the popup attribute based on this advice: https://github.com/whatwg/html/pull/8221#discussion_r987585621 TODO add a better description of this --- dom.bs | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/dom.bs b/dom.bs index adeeac9d..942ca0ae 100644 --- a/dom.bs +++ b/dom.bs @@ -1393,6 +1393,49 @@ property of the event being dispatched.
  • Otherwise, set event's {{Event/eventPhase}} attribute to {{Event/CAPTURING_PHASE}}. +

  • Let target be struct's invocation target. + +

  • If target is a Document, then: + +

      + +
    1. Let topmostPopup be the result of running topmost pop-up auto or hint + given struct's invocation target. + +

    2. If topmostPopup is not null, then: + +

        + +
      1. If event is a pointerdown event, then: + +

          +
        1. Set target's pop-up pointerdown target to the result of running + nearest open ancestral pop-up given target and "inclusive". +

        + +
      2. If event is a pointerup event, then: + +

          +
        1. Let ancestor be the result of running nearest ancestral open + pop-up given target and "inclusive". + +

        2. Let sameTarget be true if ancestor is target's + pop-up pointerdown target. + +

        3. Set target's pop-up pointerdown target to null. + +

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

        + +
      3. If event is a keydown event for the Escape key, then: + +

          +
        1. Run the hide pop-up algorithm given topmostPopup, true, and false. +

        +
      +
    +
  • Invoke with struct, event, "capturing", and legacyOutputDidListenersThrowFlag if given.