@jsenv/navi 0.29.221 → 0.29.222

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45653,15 +45653,27 @@ const handlePressOnOutsideRegion = (
45653
45653
  * answers it. The one popup where that cannot hold is the modal dialog, where
45654
45654
  * the browser has already made everything behind inert before this runs.
45655
45655
  *
45656
- * `pointerdown`, not `mousedown`, and this is what makes the reading work at
45657
- * all: a page with no wall over it is a page whose own elements arbitrate
45658
- * their presses, and cancelling a `pointerdown` — what a drag source and a
45659
- * control keeping the focus where it is both do — suppresses every
45660
- * compatibility mouse event that would have followed it. The press happens,
45661
- * reaches its target, and no `mousedown` is ever dispatched for it. Reading
45662
- * the pointer event is reading the press itself, whatever anything does with
45663
- * it afterwards, and it is the same event the drag and surface detectors
45664
- * read.
45656
+ * `pressEventType` says which event IS the press, and the two callers want
45657
+ * opposite ones:
45658
+ *
45659
+ * - `"pointerdown"` for a popup with no wall: a page with no wall over it is
45660
+ * a page whose own elements arbitrate their presses, and cancelling a
45661
+ * `pointerdown` — what a drag source and a control keeping the focus where
45662
+ * it is both do — suppresses every compatibility mouse event that would have
45663
+ * followed it. The press happens, reaches its target, and no `mousedown` is
45664
+ * ever dispatched for it. Reading the pointer event is reading the press
45665
+ * itself, whatever anything does with it afterwards, and it is the same
45666
+ * event the drag and surface detectors read.
45667
+ * - `"mousedown"` for the modal dialog, whose native `::backdrop` exists to
45668
+ * spend the press. The page's controls act on `mousedown`, and on a touch
45669
+ * screen that is not the same moment as `pointerdown`: the compatibility
45670
+ * mouse events are synthesized at `touchend` and hit-tested again then.
45671
+ * Closing on `pointerdown` takes the `::backdrop` away before that second
45672
+ * hit-test, so the `mousedown` lands on whatever the page holds under the
45673
+ * finger, and one tap both dismisses the dialog and presses the page. Read
45674
+ * on `mousedown`, the wall is still up when the press the page acts on is
45675
+ * aimed, and it catches it. Nothing behind a modal wall can cancel that
45676
+ * press, since nothing behind it hears the `pointerdown` at all.
45665
45677
  *
45666
45678
  * Capture phase, so a handler downstream that stops propagation cannot keep
45667
45679
  * the popup open either — the press is still outside whatever is made of it.
@@ -45670,7 +45682,11 @@ const handlePressOnOutsideRegion = (
45670
45682
  */
45671
45683
  const armOutsidePressClose = (
45672
45684
  popupEl,
45673
- { openController, pointerInteractionOutsideEffect },
45685
+ {
45686
+ openController,
45687
+ pointerInteractionOutsideEffect,
45688
+ pressEventType = "pointerdown",
45689
+ },
45674
45690
  ) => {
45675
45691
  const onDocumentPointerDown = (pointerDownEvent) => {
45676
45692
  if (pointerDownEvent.button !== 0) {
@@ -45727,11 +45743,11 @@ const armOutsidePressClose = (
45727
45743
  isCancel: pointerInteractionOutsideEffect === "cancel",
45728
45744
  });
45729
45745
  };
45730
- document.addEventListener("pointerdown", onDocumentPointerDown, {
45746
+ document.addEventListener(pressEventType, onDocumentPointerDown, {
45731
45747
  capture: true,
45732
45748
  });
45733
45749
  return () => {
45734
- document.removeEventListener("pointerdown", onDocumentPointerDown, {
45750
+ document.removeEventListener(pressEventType, onDocumentPointerDown, {
45735
45751
  capture: true,
45736
45752
  });
45737
45753
  };
@@ -58815,7 +58831,12 @@ const useDialogProps = props => {
58815
58831
  if ((isModal || !backdrop) && (pointerInteractionOutsideEffect === "close" || pointerInteractionOutsideEffect === "cancel")) {
58816
58832
  addCleanup(armOutsidePressClose(dialogEl, {
58817
58833
  openController,
58818
- pointerInteractionOutsideEffect
58834
+ pointerInteractionOutsideEffect,
58835
+ // A modal wall spends the press the page acts on (mousedown); a
58836
+ // local dialog with no wall lets that same press through
58837
+ // (pointerdown). See armOutsidePressClose for why the two differ on
58838
+ // a touch screen.
58839
+ pressEventType: isModal ? "mousedown" : "pointerdown"
58819
58840
  }));
58820
58841
  }
58821
58842
  return closeEvent => {