@jsenv/navi 0.29.504 → 0.29.505

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.
@@ -36601,18 +36601,18 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
36601
36601
  }
36602
36602
  entry.hidden = true;
36603
36603
  entry.page.leavingSignal.value = true;
36604
- hideNodesBetween(start, end);
36605
36604
  // The page renders on its own while kept (a component reading a signal
36606
36605
  // the address moved), never through this container: a top node it
36607
- // replaces lands between the markers unmarked. Its mutation is heard
36608
- // before the next frame.
36606
+ // replaces lands between the markers unmarked, a text it writes shows
36607
+ // again. Both are heard before the next frame.
36609
36608
  const observer = new MutationObserver(() => {
36610
36609
  if (entry.hold.released) {
36611
36610
  observer.disconnect();
36612
36611
  return;
36613
36612
  }
36614
- hideNodesBetween(start, end);
36613
+ hideNodesBetween(start, end, observer);
36615
36614
  });
36615
+ hideNodesBetween(start, end, observer);
36616
36616
  observer.observe(start.parentNode, {
36617
36617
  childList: true
36618
36618
  });
@@ -36656,18 +36656,28 @@ const useContentKeepingLeavingPages = (branch, readShownBranch, parentPage) => {
36656
36656
  };
36657
36657
  };
36658
36658
  const countRenders = count => count + 1;
36659
- const hideNodesBetween = (start, end) => {
36659
+ const hideNodesBetween = (start, end, observer) => {
36660
36660
  const focusedElement = document.activeElement;
36661
36661
  let node = start.nextSibling;
36662
36662
  while (node && node !== end) {
36663
- if (node.nodeType === Node.ELEMENT_NODE && !node.hasAttribute(LEAVING_ATTRIBUTE)) {
36664
- node.setAttribute(LEAVING_ATTRIBUTE, "");
36665
- // What the keyboard held in it goes where the page's removal would
36666
- // have sent it: a hidden element keeps the focus, and would go on
36667
- // receiving the keys pressed during the movement.
36668
- if (node.contains(focusedElement)) {
36669
- focusedElement.blur();
36670
- }
36663
+ if (node.nodeType === Node.ELEMENT_NODE) {
36664
+ if (!node.hasAttribute(LEAVING_ATTRIBUTE)) {
36665
+ node.setAttribute(LEAVING_ATTRIBUTE, "");
36666
+ // What the keyboard held in it goes where the page's removal would
36667
+ // have sent it: a hidden element keeps the focus, and would go on
36668
+ // receiving the keys pressed during the movement.
36669
+ if (node.contains(focusedElement)) {
36670
+ focusedElement.blur();
36671
+ }
36672
+ }
36673
+ } else if (node.nodeType === Node.TEXT_NODE && node.data !== "") {
36674
+ // No CSS reaches a text node, and it stays where it is: Preact inserts
36675
+ // next to it. Emptied for good, since the page is taken down without
36676
+ // being shown again, and Preact only writes it when its text changes.
36677
+ node.data = "";
36678
+ observer.observe(node, {
36679
+ characterData: true
36680
+ });
36671
36681
  }
36672
36682
  node = node.nextSibling;
36673
36683
  }