Skip to content

History / Scroll Spy

Revisions

  • docs: add Scroll Spy page + cross-link across hash, scroll-restoration, 6 adapters (#575) NEW Scroll-Spy.md — flagship page (~350 lines) symmetric with Scroll-Restoration.md and View-Transitions.md: * Why not a plugin (DOM-agnostic core, IntersectionObserver = DOM) * Opt-in syntax for all 5 web adapters + Angular DI * Options table (selector / rootMargin / scrollContainer) + hardcoded internals (threshold, debounce, cooldown) * Behavior matrix per event (user scroll, Link hash click, F5, stale hash, same-hash skip, self-emit guard) * Anti-flicker architecture deep-dive (isTransitioning + coolingDown + selfEmitting; scrollend Baseline 2026; 500ms fallback timeout) * Plugin compatibility (browser/navigation full; hash/memory/no-URL warn-once + NOOP) * Self-healing on init for stale hashes (/page#nonexistent) * Filtering hash-only transitions idiom (RFC §13 user-land filter pattern + pipeline cost table) * Three recipes (Custom IO alongside spy, Per-route config, TOC sidebar in ~30 LOC) * 8 edge cases / known limitations * Comparison table with Link hash and Scroll-Restoration anchor scrolling UPDATED Hash.md — expanded "Comparison: Hash Features" into a 3-column table (Link hash / anchorScrolling / createScrollSpy) + new "Filtering Hash-only Transitions" section documenting the user-land filter that applies to all three sources of hashChanged: true (clicks, popstate, spy emits). Lists which pipeline phases fire on hash-only transitions (subscribe yes, onStay/onNavigate yes, guards no, onLeave/onEnter no). UPDATED Scroll-Restoration.md — added scroll-spy emit row to the "Behaviour change under browser-plugin" matrix (replace: true → skip, no magnetic snap) + cross-link in See Also. Foundation #648 closure now applies to spy emits. UPDATED RouterProvider.md — added scrollSpy row to the props table + full subsection between scrollRestoration and viewTransitions (options table, per-framework code, plugin compatibility note). UPDATED 6 adapter integration pages (React, Preact, Solid, Vue, Svelte, Angular) — scrollSpy mention in the Components table + per- framework code block with reactivity notes specific to that adapter (React/Preact useEffect with primitive deps, Solid dedicated onMount block, Vue watchToggleableUtility now four utilities, Svelte $effect + $derived + untrack, Angular bootstrap-time snapshot via provideEnvironmentInitializer + installScrollSpy). UPDATED Navigation-Plugin.md — expanded "Router-driven mutations re- enter the navigate handler" edge case to document the event.intercept({ scroll: "manual" }) override that closes the scroll-spy + slow user scroll viewport-jump bug. Cross-links to Hash, Scroll-Restoration, and Scroll-Spy in See Also. UPDATED Home.md — added Scroll Spy bullet alongside Scroll Restoration in the concept overview. UPDATED Ink-Integration.md — added scrollSpy row to the "feature unavailable in terminal" table (symmetric with scrollRestoration: DOM-only, no terminal equivalent). UPDATED recipes.md — added companion blockquote in Scroll Restoration section pointing to Scroll Spy for the opposite direction (scroll → URL) with TOC sidebar pattern hint. UPDATED _Sidebar.md — added Scroll Spy link in DOM Utilities section (alphabetically between Scroll Restoration and View Transitions). Closes destination-404 gap: README/CLAUDE/IMPLEMENTATION_NOTES across 17 files in the main monorepo already link to wiki/Scroll-Spy. UPDATED Link.md — retargeted link-hash example URL to its new location in hash-examples/ subgroup (aligns with PR #695 commit chore(react): move link-hash + scroll-restoration into hash-examples). Total: 1 new flagship page + 15 cross-linked updates. Companion to real-router monorepo PR #695 — scroll-spy implementation, examples, docs, and adapter wiring. Refs greydragon888/real-router#575

    @greydragon888 greydragon888 committed Jun 2, 2026