@readme/markdown 14.11.1 → 14.11.2

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.
@@ -92021,6 +92021,34 @@ function useScrollHighlight(navRef) {
92021
92021
  return scrollParent.scrollHeight > scrollParent.clientHeight
92022
92022
  && scrollParent.scrollTop + scrollParent.clientHeight >= scrollParent.scrollHeight - SCROLL_BOTTOM_TOLERANCE;
92023
92023
  };
92024
+ /**
92025
+ * Keeps the active link visible within the TOC's own scroll container —
92026
+ * the same result as `scrollIntoView({ block: 'nearest' })`, but scoped to
92027
+ * a single scroller. `scrollIntoView` adjusts *every* scrollable ancestor,
92028
+ * and starting a scroll on the page's content scroller cancels any
92029
+ * in-flight smooth scroll there — e.g. the hub's scroll-to-top reset when
92030
+ * navigating between pages (CX-3667).
92031
+ */
92032
+ const scrollTOCLinkIntoView = (link) => {
92033
+ const tocScroller = TableOfContents_getScrollParent(link);
92034
+ // Without a TOC-local scroll area, the link's nearest scrollable
92035
+ // ancestor is the window (`getScrollParent`'s fallback) or the scroller
92036
+ // holding the page content — never auto-scroll those just to reveal a
92037
+ // TOC link.
92038
+ if (!(tocScroller instanceof HTMLElement) || tocScroller.contains(headings[0]))
92039
+ return;
92040
+ const scrollerRect = tocScroller.getBoundingClientRect();
92041
+ const linkRect = link.getBoundingClientRect();
92042
+ if (linkRect.top < scrollerRect.top) {
92043
+ tocScroller.scrollTo?.({ top: tocScroller.scrollTop + (linkRect.top - scrollerRect.top), behavior: 'smooth' });
92044
+ }
92045
+ else if (linkRect.bottom > scrollerRect.bottom) {
92046
+ tocScroller.scrollTo?.({
92047
+ top: tocScroller.scrollTop + (linkRect.bottom - scrollerRect.bottom),
92048
+ behavior: 'smooth',
92049
+ });
92050
+ }
92051
+ };
92024
92052
  const activate = (id) => {
92025
92053
  if (id === activeId)
92026
92054
  return;
@@ -92037,7 +92065,7 @@ function useScrollHighlight(navRef) {
92037
92065
  const linkRect = link.getBoundingClientRect();
92038
92066
  nav.style.setProperty('--ToC-border-active-height', `${linkRect.height}px`);
92039
92067
  nav.style.setProperty('--ToC-border-active-top', `${linkRect.top - navRect.top}px`);
92040
- link.scrollIntoView?.({ block: 'nearest', behavior: 'smooth' });
92068
+ scrollTOCLinkIntoView(link);
92041
92069
  }
92042
92070
  }
92043
92071
  };