Skip to content

Navbar renders with stale dark-section tone on /blog/ (invisible against paper) #112

@yigitdot

Description

@yigitdot

Summary

When navigating from the home page (while scrolled into a dark-toned section like #compare or #faq) to /blog/ via the nav "Blog" link, the navbar stays painted in its dark-section styling — white wordmark and links on the paper-toned blog page — so it reads as "appears then disappears." Same issue applies to /blog/[slug]/.

Repro

  1. Open /.
  2. Scroll until #compare or #faq is under the nav (navbar should flip to white-on-dark).
  3. Click the "Blog" link in the nav.
  4. On /blog/, the wordmark and nav links are effectively invisible — only the underline accents are faintly visible. Reloading /blog/ directly renders correctly (active resets to "intro").

Cause

components/site/Chrome.tsx lives in the root layout and is not remounted across client-side navigations. The IO effect (Chrome.tsx:60-118) re-runs on pathname change but early-returns when none of SECTION_IDS = ["intro", "compare", "method", "faq", "contact"] exist in the DOM:

const nodes = SECTION_IDS.map((id) => document.getElementById(id)).filter(
  (n): n is HTMLElement => n !== null,
);
if (nodes.length === 0) return;

On /blog/ (which only renders <Frame id="blog">) the effect bails before resetting active, so active retains its last home-page value. If that value is in DARK_SECTIONS ("compare" or "faq"), onDark stays true and the nav renders with text-paper over a paper-toned page.

Suggested fix

When the effect finds no observable sections, reset state to a known-light default before returning — e.g.:

if (nodes.length === 0) {
  setActive("intro");
  return;
}

Or, more explicitly, derive the off-home tone from pathname instead of letting active carry across routes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions