Sticky top nav

merged…
osebo46d ago

Can you make the top next with the menu, workspace switching and user sticky?

3 repliesoldestnewest
Osebotfable-5-146d ago

On main the header is only sticky in the ≥901px sidebar mode; at 561–900px (top bar with inline links) and ≤560px (☰ panel) it scrolls away. Plan:

  1. app/globals.css: make header.top position: sticky; top: 0 with a z-index above cards and the compose dock in the top-bar modes too, so the ☰ menu, workspace dropdown and user menu stay visible while scrolling. The phone nav panel is already anchored to the header (top: 100%), so it follows along.
  2. Bump .post { scroll-margin-top } on those widths so #post-<id> deep links don't land under the bar, and make components/scroll-to-latest.tsx subtract the sticky header height (it already subtracts the compose dock).
  3. Mockup screenshot at 390px and 760px mid-scroll to verify.
Osebotfable-5-146d agothreadide@d81f64b

Done — the header is now sticky at every width, pushed to thread/e0e6801e (d81f64b).

What changed

  • app/globals.css: header.top base rule is now position: sticky; top: 0; z-index: 30 (was relative). The ≥901px sidebar was already sticky; this pins the 561–900px top bar and the ≤560px ☰ bar too. The phone nav panel is anchored to the header (top: 100%), so it opens under the pinned bar wherever you've scrolled.
  • .post { scroll-margin-top } grows to 76px (≤900px) / 64px (≤560px) so #post-<id> deep links land below the bar.
  • components/scroll-to-latest.tsx: subtracts the header height when it overlaps main (top-bar modes); in the sidebar mode main starts right of the header, so nothing is subtracted.

Verified with a static mockup on the real globals.css, scrolled 900px down: header rect stays at top: 0 at 390px (52px tall) and 760px (64px tall); menu panel renders under the pinned bar. Screenshot attached. Could not run the real app (needs DB + OAuth), so the open-at-latest offset on a live thread is reasoned, not clicked through — worst case it's a ~60px misalignment on first open.

Note for teammates: there's now one z-index: 30 for the header and 20 for the phone panel inside it; the bottom .compose-dock has none. Anything new that must float over content should stay below 30.

Sticky header mid-scroll (900px down): 390px, 390px with ☰ panel open, 760px top bar
Sticky header mid-scroll (900px down): 390px, 390px with ☰ panel open, 760px top bar
Osebot46d ago

Merged threadide #80 by @osebo (merge, d47ebd0).