Skip to content

website: one menu with scroll spy as submenu, fix logo nav, sticky menu on mobile - #209

Merged
leonidaz merged 8 commits into
mainfrom
website
Jul 20, 2026
Merged

leonidaz merged 8 commits into
mainfrom
website

Conversation

@leonidaz

@leonidaz leonidaz commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

Note

Low Risk
Website-only layout, navigation, and scroll behavior with broad test coverage; no auth, data, or API changes.

Overview
Docs and benchmarks now use a single left sidebar: doc links (or a Benchmarks row) with On this page nested under the active item, instead of a separate right rail and mobile-only TOC card. OnThisPage is slimmed to the animated section list; hosts own the responsive shell.

Mobile navigation replaces <details> with a toggle + animated panel via useAnimatedMobileNavigation, which waits on real CSS close animations before section jumps. TOC clicks use optional onNavigate so scrolling runs after the overlay closes; navigation tokens cancel stale deferred jumps when the route changes mid-close.

Scroll-spy adjusts its activation line from heading scroll-margin-top and from sticky [data-scroll-spy-mobile-host] overlap on docs mobile. Router uses scrollRestorationBehavior: 'instant' on route changes so new pages start at the top without animating from the previous anchor.

Header adds --topnav-height, applies it to bar/dropdown positioning, and sets pointer-events: none on the inline wordmark SVG so intent preloading cannot cancel home navigation. DocPage drops the article TOC column and increases mobile heading scroll-margin-top for the sticky docs bar.

Unit and e2e tests cover sidebar placement, menu collapse, instant doc swaps, and cancelled mobile section navigation.

Reviewed by Cursor Bugbot for commit 89ca037. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
octane-website Ready Ready Preview, Comment Jul 20, 2026 11:10pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
octane-website-mcp Skipped Skipped Jul 20, 2026 11:10pm

Request Review

@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 20, 2026 21:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 20, 2026 21:50 Inactive

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Mobile TOC highlight lost after click
    • Aligned the sticky mobile activation line with each heading's computed scroll margin and added a settled-highlight browser regression check.

Create PR

Or push these changes by commenting:

@cursor push e9eb41bc93
Preview (e9eb41bc93)
diff --git a/website/src/components/OnThisPage.tsrx b/website/src/components/OnThisPage.tsrx
--- a/website/src/components/OnThisPage.tsrx
+++ b/website/src/components/OnThisPage.tsrx
@@ -29,7 +29,10 @@
 	const hostRect = host.getBoundingClientRect();
 	const headingRect = heading.getBoundingClientRect();
 	const overlapsHeading = hostRect.left < headingRect.right && hostRect.right > headingRect.left;
-	if (overlapsHeading) return Math.max(ACTIVATION_LINE, hostRect.bottom + 12);
+	const scrollMarginTop = Number.parseFloat(getComputedStyle(heading).scrollMarginTop) || 0;
+	if (overlapsHeading) {
+		return Math.max(ACTIVATION_LINE, hostRect.bottom + 12, scrollMarginTop);
+	}
 	return ACTIVATION_LINE;
 }
 // How long after the last scroll tick a TOC click is considered settled. Long

diff --git a/website/tests/ssr-hydration.e2e.test.ts b/website/tests/ssr-hydration.e2e.test.ts
--- a/website/tests/ssr-hydration.e2e.test.ts
+++ b/website/tests/ssr-hydration.e2e.test.ts
@@ -666,6 +666,12 @@
 				null,
 				{ timeout: 10_000 },
 			);
+			// The settled scroll spy must keep the chosen row active after the
+			// click lock releases.
+			await page.waitForTimeout(350);
+			expect(
+				await page.locator('.on-this-page a[href="#rspack"]').getAttribute('aria-current'),
+			).toBe('true');
 			const real = errors.filter((error) => !error.includes('Failed to load resource'));
 			expect(real).toEqual([]);
 		} finally {

You can send follow-ups to the cloud agent here.

Comment thread website/src/components/OnThisPage.tsrx Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 20, 2026 22:19 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 20, 2026 22:20 Inactive

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Duplicated mobile menu close logic
    • Extracted the shared mobile navigation state, reduced-motion handling, and close delay into one hook used by both hosts.

Create PR

Or push these changes by commenting:

@cursor push 42a2cc8813
Preview (42a2cc8813)
diff --git a/website/src/hooks/use-mobile-navigation.ts b/website/src/hooks/use-mobile-navigation.ts
new file mode 100644
--- /dev/null
+++ b/website/src/hooks/use-mobile-navigation.ts
@@ -1,0 +1,24 @@
+import { useState } from 'octane';
+
+const MOBILE_NAVIGATION_CLOSE_MS = 240;
+
+export function useMobileNavigation() {
+	const [open, setOpen] = useState(false);
+	const close = () => {
+		if (!open) return;
+		setOpen(false);
+		// Reveal the target only after the panel transition has finished.
+		const reduce =
+			typeof window.matchMedia === 'function' &&
+			window.matchMedia('(prefers-reduced-motion: reduce)').matches;
+		return new Promise<void>((resolve) =>
+			window.setTimeout(resolve, reduce ? 0 : MOBILE_NAVIGATION_CLOSE_MS),
+		);
+	};
+
+	return {
+		open,
+		toggle: () => setOpen((current) => !current),
+		close,
+	};
+}

diff --git a/website/src/layouts/DocsLayout.tsrx b/website/src/layouts/DocsLayout.tsrx
--- a/website/src/layouts/DocsLayout.tsrx
+++ b/website/src/layouts/DocsLayout.tsrx
@@ -1,22 +1,12 @@
 // Docs section shell: sidebar of documents (from the registry) + the routed
 // document via <Outlet/>.
 import { Link, Outlet, useParams } from '@octanejs/tanstack-router';
-import { useState } from 'octane';
 import { OnThisPage } from '../components/OnThisPage.tsrx';
 import { docGroups, defaultDoc, findDoc } from '../content/docs.ts';
+import { useMobileNavigation } from '../hooks/use-mobile-navigation.ts';
 
 export function DocsLayout() @{
-	const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
-	const closeMobileNavigation = () => {
-		if (!mobileMenuOpen) return;
-		setMobileMenuOpen(false);
-		// Reveal the target only after the overlay has closed. A timer also covers
-		// browsers that omit transitionend.
-		const reduce =
-			typeof window.matchMedia === 'function' &&
-				window.matchMedia('(prefers-reduced-motion: reduce)').matches;
-		return new Promise<void>((resolve) => window.setTimeout(resolve, reduce ? 0 : 240));
-	};
+	const mobileNavigation = useMobileNavigation();
 
 	// The Link's own data-status covers `/docs/$slug`, but the bare `/docs` index
 	// renders the default doc (quick-start) without a slug in the URL — so no link
@@ -31,14 +21,14 @@
 			<button
 				type="button"
 				class="sidebar-mobile-toggle"
-				aria-expanded={mobileMenuOpen}
+				aria-expanded={mobileNavigation.open}
 				aria-controls="docs-sidebar-nav"
-				onClick={() => setMobileMenuOpen((open) => !open)}
+				onClick={mobileNavigation.toggle}
 			>
 				<span>Documentation</span>
 				<span class="sidebar-mobile-icon" aria-hidden="true">+</span>
 			</button>
-			<div class={['sidebar-panel', mobileMenuOpen && 'is-open']}>
+			<div class={['sidebar-panel', mobileNavigation.open && 'is-open']}>
 				<div class="sidebar-panel-inner">
 					<nav id="docs-sidebar-nav" class="sidebar-nav" aria-label="Documentation">
 						<p class="sidebar-title">Documentation</p>
@@ -56,7 +46,7 @@
 													params={{ slug: doc.slug }}
 													class={['sidebar-link', indexActive(doc.slug) && 'is-active']}
 													onClick={() => {
-														void closeMobileNavigation();
+														void mobileNavigation.close();
 													}}
 												>
 													{doc.title as string}
@@ -65,7 +55,7 @@
 													<OnThisPage
 														sections={doc.sections}
 														resetKey={doc.slug}
-														onNavigate={closeMobileNavigation}
+														onNavigate={mobileNavigation.close}
 													/>
 												}
 											</li>

diff --git a/website/src/pages/benchmarks/Benchmarks.tsrx b/website/src/pages/benchmarks/Benchmarks.tsrx
--- a/website/src/pages/benchmarks/Benchmarks.tsrx
+++ b/website/src/pages/benchmarks/Benchmarks.tsrx
@@ -6,12 +6,12 @@
 // then the octane-internal de-opt ("authoring cliff") suites. All numbers are the
 // checked-in benchmark scores; the page cannot drift from the repo because the
 // JSON is imported at build time.
-import { useState } from 'octane';
 import { BenchBars } from '../../components/BenchBars.tsrx';
 import { BenchmarkExplorer } from '../../components/BenchmarkExplorer.tsrx';
 import { OnThisPage } from '../../components/OnThisPage.tsrx';
 import { FRAMEWORK_CARDS, OCTANE_CARDS } from '../../content/benchmarks.ts';
 import { createHomeSummary } from '../../content/home-benchmark.ts';
+import { useMobileNavigation } from '../../hooks/use-mobile-navigation.ts';
 import { useTitle } from '../../hooks/use-title.ts';
 
 const OVERVIEW = createHomeSummary(FRAMEWORK_CARDS);
@@ -37,15 +37,7 @@
 
 export function Benchmarks() @{
 	useTitle('Octane — Benchmarks');
-	const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
-	const closeMobileNavigation = () => {
-		if (!mobileMenuOpen) return;
-		setMobileMenuOpen(false);
-		const reduce =
-			typeof window.matchMedia === 'function' &&
-				window.matchMedia('(prefers-reduced-motion: reduce)').matches;
-		return new Promise<void>((resolve) => window.setTimeout(resolve, reduce ? 0 : 240));
-	};
+	const mobileNavigation = useMobileNavigation();
 
 	<div class="benchpage">
 		<div class="benchpage-frame">
@@ -53,14 +45,14 @@
 				<button
 					type="button"
 					class="benchpage-sidebar-toggle"
-					aria-expanded={mobileMenuOpen}
+					aria-expanded={mobileNavigation.open}
 					aria-controls="benchmark-sidebar-nav"
-					onClick={() => setMobileMenuOpen((open) => !open)}
+					onClick={mobileNavigation.toggle}
 				>
 					<span>Benchmarks</span>
 					<span class="benchpage-sidebar-icon" aria-hidden="true">+</span>
 				</button>
-				<div class={['benchpage-sidebar-panel', mobileMenuOpen && 'is-open']}>
+				<div class={['benchpage-sidebar-panel', mobileNavigation.open && 'is-open']}>
 					<div class="benchpage-sidebar-panel-inner">
 						<div id="benchmark-sidebar-nav">
 							<a class="benchpage-sidebar-link" href="/benchmarks" aria-current="page">
@@ -69,7 +61,7 @@
 							<OnThisPage
 								sections={BENCH_SECTIONS}
 								resetKey="benchmarks"
-								onNavigate={closeMobileNavigation}
+								onNavigate={mobileNavigation.close}
 							/>
 						</div>
 					</div>

You can send follow-ups to the cloud agent here.

Comment thread website/src/layouts/DocsLayout.tsrx Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 20, 2026 22:40 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 20, 2026 22:41 Inactive

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Stale TOC navigation after route change
    • Deferred TOC navigation now aborts when the route changes or the captured heading is replaced before the mobile panel closes.

Create PR

Or push these changes by commenting:

@cursor push 2a45d55e27
Preview (2a45d55e27)
diff --git a/website/src/components/OnThisPage.tsrx b/website/src/components/OnThisPage.tsrx
--- a/website/src/components/OnThisPage.tsrx
+++ b/website/src/components/OnThisPage.tsrx
@@ -252,7 +252,11 @@
 		const heading = document.getElementById(id);
 		if (!heading) return;
 		event.preventDefault();
+		const pageUrl = location.pathname + location.search;
 		const navigate = () => {
+			const stillCurrent =
+				location.pathname + location.search === pageUrl && document.getElementById(id) === heading;
+			if (!stillCurrent) return;
 			const reduce =
 				typeof window.matchMedia === 'function' &&
 					window.matchMedia('(prefers-reduced-motion: reduce)').matches;

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 8bda87b. Configure here.

Comment thread website/src/components/OnThisPage.tsrx Resolved
@vercel
vercel Bot temporarily deployed to Preview – octane-website-mcp July 20, 2026 23:09 Inactive
@vercel
vercel Bot temporarily deployed to Preview – octane-website July 20, 2026 23:10 Inactive
@leonidaz
leonidaz merged commit 7476345 into main Jul 20, 2026
22 checks passed
@leonidaz
leonidaz deleted the website branch July 20, 2026 23:26
mrdiyorbek-juraev added a commit to mrdiyorbek-juraev/octane that referenced this pull request Jul 21, 2026
Brings in 5 upstream commits: the safe inline-script content contract
(octanejs#215), the tanstack.com shell port (octanejs#214), the TSRX directive arm output
docs (octanejs#213), the inline hook-memo tier (octanejs#208), and the website menu /
scroll-spy work (octanejs#209). Upstream added three bindings
(tanstack-router-ssr-query, tanstack-hotkeys, tanstack-pacer), taking the
table to 39.

Six conflicts, all resolved as unions so neither side lost content:

- website/src/content/bindings.json — @octanejs/cmdk listed alongside
  upstream's three new bindings; the "UI and interaction" description
  keeps command menus and gains keyboard shortcuts and event pacing.
- website/public/llms.txt — same union in prose form.
- docs/bindings-status.md, docs/packages.md, docs/binding-parity-gaps.md
  and the evals user-apps-v1 manifest are generated, so they were taken
  from upstream and regenerated (39 bindings, 48 publishable packages,
  0 parity pins, 19 eval tasks).

packages/cmdk is byte-identical to its pre-merge state; upstream's
compiler changes do not perturb it. Verified: 32/32 cmdk and cmdk-ssr
tests including both differential parity checks against [email protected],
tsrx-tsc and tsgo clean, prettier clean, and all five freshness gates
current.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

This branch was previously deployed

2 inactive deployments
Preview – octane-website — 89ca037d Deployed Jul 20, 2026 by vercel[bot]
Preview – octane-website-mcp — 89ca037d Deployed Jul 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants