Align menu with evenings text

merged…
osebo56d ago

It’s too far down

IMG_8256.jpeg
IMG_8256.jpeg
2 repliesoldestnewest
Osebotfable-5-156d ago

The ☰ in the phone header is the Unicode glyph "☰" rendered by whatever fallback font iOS picks; that glyph sits low in its em box, so even though the button itself is vertically centred (inline-flex; align-items:center), the drawn bars land ~6px below the EVENINGS baseline.

Plan: stop relying on a font glyph. Draw the hamburger (and the ✕ when open) with CSS — a 18px span with three 2px bars via ::before/::after + box-shadow, rotated into an × when aria-expanded=true. Pure geometry, so it centres identically on every OS/font. Only components/site-nav.tsx (drop the glyph text) and app/globals.css (≤560px block) change. Will verify with a static mockup screenshot at 390px.

Osebotfable-5-156d agothreadide@542c079

Fixed and pushed on thread/9472a604 (threadide 542c079).

Cause. The phone ☰ was the literal Unicode character "☰" (and "✕" when open). The button itself was correctly vertically centred, but the glyph comes from whatever symbol font the OS falls back to, and on iOS that glyph sits low in its em box — so the bars landed ~6px below the EVENINGS baseline, as in your screenshot. Chromium's fallback happens to centre it, which is why it looked fine in earlier desktop-emulated checks.

Fix. Draw the icon in CSS instead of relying on a font:

  • components/site-nav.tsx: the button now contains an empty <span class="nav-icon"> (still aria-hidden; the aria-label carries the accessible name).
  • app/globals.css (≤560px block): .nav-icon is an 18×14px box; ::before is the top bar with a box-shadow for the middle bar, ::after is the bottom bar. When .nav-toggle[aria-expanded="true"], the shadow is dropped and the two bars rotate ±45° into an ×. 150ms transition. Pure geometry → identical centring on every OS.

Verified with a static dark-mode mockup at 390px (attached, closed + open states) and 900px desktop unchanged (.nav-toggle is still display:none there). tsc --noEmit passes.

Saved a gotcha note: don't use Unicode symbol glyphs as UI icons in this app — use CSS or inline SVG.

390px dark header after fix — CSS-drawn ☰ centred on the EVENINGS cap-height
390px dark header after fix — CSS-drawn ☰ centred on the EVENINGS cap-height
Menu open — same bars rotate into an ×
Menu open — same bars rotate into an ×
Diff · 2 files
diff --git a/threadide/app/globals.css b/threadide/app/globals.css
--- a/threadide/app/globals.css
+++ b/threadide/app/globals.css
@@ -87,9 +87,18 @@ header.top > span:last-child { order: 2; }
   .nav-toggle {
     display: inline-flex; align-items: center; justify-content: center;
     width: 36px; height: 36px; padding: 0; margin-left: -6px;
-    background: none; color: var(--text); font-size: 20px; line-height: 1; border-radius: 3px;
-    text-transform: none; letter-spacing: 0;
+    background: none; color: var(--text); line-height: 0; border-radius: 3px;
   }
+  /* Hamburger drawn with borders instead of the ☰ glyph so it centres exactly on the title regardless of font. */
+  .nav-icon { position: relative; display: block; width: 18px; height: 14px; }
+  .nav-icon::before, .nav-icon::after {
+    content: ""; position: absolute; left: 0; width: 18px; height: 2px; border-radius: 1px;
+    background: currentColor; transition: transform .15s ease, box-shadow .15s ease;
+  }
+  .nav-icon::before { top: 0; box-shadow: 0 6px 0 currentColor; } /* top bar + middle bar */
+  .nav-icon::after { bottom: 0; }
+  .nav-toggle[aria-expanded="true"] .nav-icon::before { top: 6px; box-shadow: none; transform: rotate(45deg); }
+  .nav-toggle[aria-expanded="true"] .nav-icon::after { bottom: 6px; transform: rotate(-45deg); }
   .nav-toggle:hover, .nav-toggle:focus-visible { background: rgba(128,128,128,.18); }
diff --git a/threadide/components/site-nav.tsx b/threadide/components/site-nav.tsx
--- a/threadide/components/site-nav.tsx
+++ b/threadide/components/site-nav.tsx
@@ -51,7 +51,9 @@ export function SiteNav() {
         aria-controls={panelId}
         onClick={() => setOpen((o) => !o)}
       >
-        <span aria-hidden="true">{open ? "✕" : "☰"}</span>
+        {/* Drawn in CSS (three bars → ×) rather than the ☰/✕ glyphs: font glyphs sit at
+            font-dependent vertical offsets, which on iOS pushed the icon below the title baseline. */}
+        <span className="nav-icon" aria-hidden="true" />
       </button>