@jsenv/navi 0.29.327 → 0.29.328

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.
@@ -7071,6 +7071,16 @@ const positionCallout = (
7071
7071
  }
7072
7072
  return;
7073
7073
  }
7074
+ if (!calloutElement.isConnected) {
7075
+ // The callout is drawn inside the anchor's subtree (calloutContainer),
7076
+ // so it leaves the document with it — a Suspense boundary parking
7077
+ // the screen while an action re-runs keeps the subtree mounted, refs
7078
+ // intact, but detached. showPopover() throws on a detached element,
7079
+ // and leaving the document already took it out of the top layer, so
7080
+ // there is nothing to hide either: same as ancestorClosed, wait for
7081
+ // the next check, which shows it again once the subtree is back.
7082
+ return;
7083
+ }
7074
7084
  if (!calloutElement.matches(":popover-open")) {
7075
7085
  if (debug) {
7076
7086
  debug(event, "showing callout because anchor is visible again");
@@ -26438,20 +26448,28 @@ const setupBrowserIntegrationViaHistory = ({
26438
26448
  // traversal to another document is a full page load, which no press on a
26439
26449
  // link asked for — the entries that are ours are recorded as they are
26440
26450
  // created, starting with the one this document was loaded into.
26451
+ //
26452
+ // The presence of window.navigation says nothing about the entry: the spec
26453
+ // makes currentEntry null in a document that is not fully active, and iOS
26454
+ // Safari answers null in a document that plainly is (a booted app, minutes
26455
+ // into a session). Nothing can be done about it; an entry that cannot be
26456
+ // read is treated as a browser without the API, which only costs the
26457
+ // adjacency.
26441
26458
  const sameDocumentEntryKeys = new Set();
26442
26459
  const rememberEntryIsOfThisDocument = () => {
26443
- if (window.navigation) {
26444
- sameDocumentEntryKeys.add(window.navigation.currentEntry.key);
26460
+ const currentEntry = window.navigation?.currentEntry;
26461
+ if (currentEntry) {
26462
+ sameDocumentEntryKeys.add(currentEntry.key);
26445
26463
  }
26446
26464
  };
26447
26465
  rememberEntryIsOfThisDocument();
26448
26466
  const adjacentEntryDelta = (url) => {
26449
- const { navigation } = window;
26450
- if (!navigation) {
26467
+ const currentEntry = window.navigation?.currentEntry;
26468
+ if (!currentEntry) {
26451
26469
  return 0;
26452
26470
  }
26453
- const entries = navigation.entries();
26454
- const index = navigation.currentEntry.index;
26471
+ const entries = window.navigation.entries();
26472
+ const index = currentEntry.index;
26455
26473
  // Behind first: when the same page stands on both sides (A, B, A and one
26456
26474
  // is on B), a link to it reads as going back.
26457
26475
  for (const delta of [-1, 1]) {