@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.
@@ -7325,6 +7325,16 @@ const positionCallout = (
7325
7325
  }
7326
7326
  return;
7327
7327
  }
7328
+ if (!calloutElement.isConnected) {
7329
+ // The callout is drawn inside the anchor's subtree (calloutContainer),
7330
+ // so it leaves the document with it — a Suspense boundary parking
7331
+ // the screen while an action re-runs keeps the subtree mounted, refs
7332
+ // intact, but detached. showPopover() throws on a detached element,
7333
+ // and leaving the document already took it out of the top layer, so
7334
+ // there is nothing to hide either: same as ancestorClosed, wait for
7335
+ // the next check, which shows it again once the subtree is back.
7336
+ return;
7337
+ }
7328
7338
  if (!calloutElement.matches(":popover-open")) {
7329
7339
  if (debug) {
7330
7340
  debug(event, "showing callout because anchor is visible again");
@@ -27188,20 +27198,28 @@ const setupBrowserIntegrationViaHistory = ({
27188
27198
  // traversal to another document is a full page load, which no press on a
27189
27199
  // link asked for — the entries that are ours are recorded as they are
27190
27200
  // created, starting with the one this document was loaded into.
27201
+ //
27202
+ // The presence of window.navigation says nothing about the entry: the spec
27203
+ // makes currentEntry null in a document that is not fully active, and iOS
27204
+ // Safari answers null in a document that plainly is (a booted app, minutes
27205
+ // into a session). Nothing can be done about it; an entry that cannot be
27206
+ // read is treated as a browser without the API, which only costs the
27207
+ // adjacency.
27191
27208
  const sameDocumentEntryKeys = new Set();
27192
27209
  const rememberEntryIsOfThisDocument = () => {
27193
- if (window.navigation) {
27194
- sameDocumentEntryKeys.add(window.navigation.currentEntry.key);
27210
+ const currentEntry = window.navigation?.currentEntry;
27211
+ if (currentEntry) {
27212
+ sameDocumentEntryKeys.add(currentEntry.key);
27195
27213
  }
27196
27214
  };
27197
27215
  rememberEntryIsOfThisDocument();
27198
27216
  const adjacentEntryDelta = (url) => {
27199
- const { navigation } = window;
27200
- if (!navigation) {
27217
+ const currentEntry = window.navigation?.currentEntry;
27218
+ if (!currentEntry) {
27201
27219
  return 0;
27202
27220
  }
27203
- const entries = navigation.entries();
27204
- const index = navigation.currentEntry.index;
27221
+ const entries = window.navigation.entries();
27222
+ const index = currentEntry.index;
27205
27223
  // Behind first: when the same page stands on both sides (A, B, A and one
27206
27224
  // is on B), a link to it reads as going back.
27207
27225
  for (const delta of [-1, 1]) {