fix(nav): keep sign-in and sign-up in the header without JavaScript #154

Stängd
öppnade 2026-08-02 12:30:07 +00:00 av supernaut · 0 kommentarer
Ägare

With JavaScript disabled, the header contains no "Sign in" and no "Sign up". Measured on / at
375 px with JavaScript off:

nav.user-menu present:       false
.user-menu-fallback present: true    (aria-hidden="true", two empty spans)

src/components/secondary-navigation.astro:74 renders <UserMenu server:defer>, and the only
thing in the served HTML is the layout placeholder at :75-78, which is aria-hidden="true" and
carries no links. The served HTML of /docs/faq/ contains no /auth/login link anywhere on the
page. The same hole opens with JavaScript enabled whenever the /_server-islands/UserMenu request
fails, which has no error state.

/auth/* is still a scaffold today, so this is currently latent — which makes now the cheapest
time to fix it.

Constraint: keep the island

Pages set shared-cache headers (src/pages/index.astro:13-14 public, max-age=300, s-maxage=3600; src/pages/docs/index.astro:25-26 max-age=86400; likewise /about and
/pricing). The deferred island is what keeps a signed-in user's menu out of a shared cache.
Rendering the menu inline would put it there. Do not do that.

Fix

Replace the aria-hidden placeholder with the anonymous menu — "Sign in", plus "Sign up"
gated on signupsOpen() exactly as src/components/user-menu.astro:76 already gates it. Anonymous
links are safe to cache; that is the state a shared cache should hold.

Done when

  • With JavaScript disabled, the header on /, /en/ and /docs/faq/ shows Sign in and Sign up.
  • With JavaScript enabled, a signed-in user still sees the account menu and no anonymous links
    flash first.
  • Header height is unchanged in both states — the CLS reservation documented at
    src/components/secondary-navigation.astro:35-71 must still hold.
  • No signed-in content appears in a response carrying a public cache header.

Part of gitborg/gitborg-docs#67.

With JavaScript disabled, the header contains no "Sign in" and no "Sign up". Measured on `/` at 375 px with JavaScript off: nav.user-menu present: false .user-menu-fallback present: true (aria-hidden="true", two empty spans) `src/components/secondary-navigation.astro:74` renders `<UserMenu server:defer>`, and the only thing in the served HTML is the layout placeholder at `:75-78`, which is `aria-hidden="true"` and carries no links. The served HTML of `/docs/faq/` contains no `/auth/login` link anywhere on the page. The same hole opens with JavaScript enabled whenever the `/_server-islands/UserMenu` request fails, which has no error state. `/auth/*` is still a scaffold today, so this is currently latent — which makes now the cheapest time to fix it. ## Constraint: keep the island Pages set shared-cache headers (`src/pages/index.astro:13-14` `public, max-age=300, s-maxage=3600`; `src/pages/docs/index.astro:25-26` `max-age=86400`; likewise `/about` and `/pricing`). The deferred island is what keeps a signed-in user's menu out of a shared cache. Rendering the menu inline would put it there. Do not do that. ## Fix Replace the `aria-hidden` placeholder with the **anonymous** menu — "Sign in", plus "Sign up" gated on `signupsOpen()` exactly as `src/components/user-menu.astro:76` already gates it. Anonymous links are safe to cache; that is the state a shared cache should hold. ## Done when - With JavaScript disabled, the header on `/`, `/en/` and `/docs/faq/` shows Sign in and Sign up. - With JavaScript enabled, a signed-in user still sees the account menu and no anonymous links flash first. - Header height is unchanged in both states — the CLS reservation documented at `src/components/secondary-navigation.astro:35-71` must still hold. - No signed-in content appears in a response carrying a `public` cache header. Part of gitborg/gitborg-docs#67.
supernaut lade till detta till projektet Bitborg Web 2026-08-02 12:34:21 +00:00
Logga in för att delta i denna konversation.
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-web#154
Ingen beskrivning angiven.