@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.
@@ -46275,15 +46275,27 @@ const warnAboutUnreachableOutsideRegions = (popupEl) => {
46275
46275
  * answers it. The one popup where that cannot hold is the modal dialog, where
46276
46276
  * the browser has already made everything behind inert before this runs.
46277
46277
  *
46278
- * `pointerdown`, not `mousedown`, and this is what makes the reading work at
46279
- * all: a page with no wall over it is a page whose own elements arbitrate
46280
- * their presses, and cancelling a `pointerdown` — what a drag source and a
46281
- * control keeping the focus where it is both do — suppresses every
46282
- * compatibility mouse event that would have followed it. The press happens,
46283
- * reaches its target, and no `mousedown` is ever dispatched for it. Reading
46284
- * the pointer event is reading the press itself, whatever anything does with
46285
- * it afterwards, and it is the same event the drag and surface detectors
46286
- * read.
46278
+ * `pressEventType` says which event IS the press, and the two callers want
46279
+ * opposite ones:
46280
+ *
46281
+ * - `"pointerdown"` for a popup with no wall: a page with no wall over it is
46282
+ * a page whose own elements arbitrate their presses, and cancelling a
46283
+ * `pointerdown` — what a drag source and a control keeping the focus where
46284
+ * it is both do — suppresses every compatibility mouse event that would have
46285
+ * followed it. The press happens, reaches its target, and no `mousedown` is
46286
+ * ever dispatched for it. Reading the pointer event is reading the press
46287
+ * itself, whatever anything does with it afterwards, and it is the same
46288
+ * event the drag and surface detectors read.
46289
+ * - `"mousedown"` for the modal dialog, whose native `::backdrop` exists to
46290
+ * spend the press. The page's controls act on `mousedown`, and on a touch
46291
+ * screen that is not the same moment as `pointerdown`: the compatibility
46292
+ * mouse events are synthesized at `touchend` and hit-tested again then.
46293
+ * Closing on `pointerdown` takes the `::backdrop` away before that second
46294
+ * hit-test, so the `mousedown` lands on whatever the page holds under the
46295
+ * finger, and one tap both dismisses the dialog and presses the page. Read
46296
+ * on `mousedown`, the wall is still up when the press the page acts on is
46297
+ * aimed, and it catches it. Nothing behind a modal wall can cancel that
46298
+ * press, since nothing behind it hears the `pointerdown` at all.
46287
46299
  *
46288
46300
  * Capture phase, so a handler downstream that stops propagation cannot keep
46289
46301
  * the popup open either — the press is still outside whatever is made of it.
@@ -46292,7 +46304,11 @@ const warnAboutUnreachableOutsideRegions = (popupEl) => {
46292
46304
  */
46293
46305
  const armOutsidePressClose = (
46294
46306
  popupEl,
46295
- { openController, pointerInteractionOutsideEffect },
46307
+ {
46308
+ openController,
46309
+ pointerInteractionOutsideEffect,
46310
+ pressEventType = "pointerdown",
46311
+ },
46296
46312
  ) => {
46297
46313
  const onDocumentPointerDown = (pointerDownEvent) => {
46298
46314
  if (pointerDownEvent.button !== 0) {
@@ -46349,11 +46365,11 @@ const armOutsidePressClose = (
46349
46365
  isCancel: pointerInteractionOutsideEffect === "cancel",
46350
46366
  });
46351
46367
  };
46352
- document.addEventListener("pointerdown", onDocumentPointerDown, {
46368
+ document.addEventListener(pressEventType, onDocumentPointerDown, {
46353
46369
  capture: true,
46354
46370
  });
46355
46371
  return () => {
46356
- document.removeEventListener("pointerdown", onDocumentPointerDown, {
46372
+ document.removeEventListener(pressEventType, onDocumentPointerDown, {
46357
46373
  capture: true,
46358
46374
  });
46359
46375
  };
@@ -59502,7 +59518,12 @@ const useDialogProps = props => {
59502
59518
  if ((isModal || !backdrop) && (pointerInteractionOutsideEffect === "close" || pointerInteractionOutsideEffect === "cancel")) {
59503
59519
  addCleanup(armOutsidePressClose(dialogEl, {
59504
59520
  openController,
59505
- pointerInteractionOutsideEffect
59521
+ pointerInteractionOutsideEffect,
59522
+ // A modal wall spends the press the page acts on (mousedown); a
59523
+ // local dialog with no wall lets that same press through
59524
+ // (pointerdown). See armOutsidePressClose for why the two differ on
59525
+ // a touch screen.
59526
+ pressEventType: isModal ? "mousedown" : "pointerdown"
59506
59527
  }));
59507
59528
  }
59508
59529
  return closeEvent => {