Skip to content

fix(content): mobile layout regressions on detail + listing pages#106

Merged
ahnafnafee merged 3 commits intomainfrom
fix/mobile-issues
Apr 27, 2026
Merged

fix(content): mobile layout regressions on detail + listing pages#106
ahnafnafee merged 3 commits intomainfrom
fix/mobile-issues

Conversation

@ahnafnafee
Copy link
Copy Markdown
Owner

Five tightly-coupled fixes the user surfaced from a mobile read-through.

What's wrong / what's fixed

# Issue Fix
1 Blog detail page rendered the OG thumbnail as a body hero — on narrow viewports it dominated the fold and pushed the headline below the scroll. Removed the hero <figure> from HeadingContent.tsx. Thumbnail still feeds OG/Twitter metadata + the listing card. JSON-LD primaryImage keeps the SEO canonical claim.
2 ResearchTeaser reframed the image at every breakpoint (fill + h-72 sm:h-96 md:h-[28rem] + object-cover) and clipped figure labels on mobile. Rebuilt with an aspect-video box + object-contain. Whole figure visible at any width; bg tile shows behind only when the source aspect ratio mismatches.
3 ResearchItem listing card was always row-layout — a 128px-tall thumbnail jammed against a column of wrapping text on phones. Stacks vertically on mobile (image full-width above content), md:flex-row on tablet+. Mirrors BlogItem/PortfolioItem. sizes updated so next/image picks the right resolution per breakpoint.
4 ResearchItem venue line had […] square brackets in bold. Brackets removed, switched to italic + softer color. Reads as a proper academic venue caption.
5 Internal links never scrolled to top — clicking a post link from mid-page kept the reader at the same scroll position on the new page. UnstyledLink no longer passes scroll={false} to NextLink. Default Next.js behavior (scroll-to-top on a new path, hash-aware for #anchor links) is restored.

Note on the portfolio detail body hero

The portfolio detail page (/portfolio/[slug]) also had a fill + h-56 sm:h-72 md:h-96 + object-cover body hero. I initially removed it, but the file got reverted — keeping it as-is per that signal. If you want the same treatment as blog/research applied later, I can do it in a follow-up.

Test plan

  • yarn type-check clean
  • yarn lint clean
  • yarn test 48/48
  • yarn build 50 routes
  • Mobile smoke test on /blog/<slug>, /research/<slug>, /research, /, internal nav scrolling

Five tightly-coupled fixes the user surfaced from a mobile read-through:

1. Blog post detail page no longer renders the OG thumbnail as a body
   hero. On narrow viewports it dominated the fold and pushed the
   headline below the scroll. The thumbnail still feeds OG/Twitter
   metadata + the BlogItem listing card; the post page keeps its
   canonical claim via JSON-LD primaryImage.

2. ResearchTeaser rebuilt with an `aspect-video` box + `object-contain`
   so the entire scientific figure is visible at every viewport width.
   The previous `fill + h-72/h-96/h-[28rem] + object-cover` pattern
   reframed the image at every breakpoint and clipped figure labels
   on mobile.

3. ResearchItem listing card stacks vertically on mobile (image full
   width above content) and lays out side-by-side from md+ — matching
   the BlogItem / PortfolioItem pattern. The previous always-row
   layout left a 128px-tall thumbnail squished against a column of
   wrapping text on phones. `sizes` updated so next/image requests the
   right resolution at each breakpoint.

4. ResearchItem venue line: dropped the `[…]` square brackets, switched
   to italic + softer color. Reads as a venue caption (academic
   convention) instead of bracketed metadata.

5. UnstyledLink no longer passes `scroll={false}` to NextLink. Default
   Next.js behavior (scroll-to-top on a new path, hash-aware for
   in-page anchors) is restored — the previous flag stranded readers
   mid-page when navigating between posts.

Verified: yarn type-check, yarn lint, yarn test (48/48), yarn build
(50 routes) all clean.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

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

Project Deployment Actions Updated (UTC)
ahnafnafee-dev Ready Ready Preview, Comment Apr 27, 2026 1:30am

The research listing thumbnail used `object-cover` with `aspect-[5/4]`,
which cropped the sides of the image when the source had a wider aspect
ratio than 5:4 — losing visible content (e.g. the "Vertex Clustering"
column on the mesh-decimation thumbnail got clipped on mobile).

Research figures often have edge-to-edge content (axes, labels, panel
titles) that can't be safely cropped by a center-focused fit. Switch to
`object-contain` so the full image always fits within the box; the
existing bg-gray tile fills any letterbox gaps when the source aspect
ratio doesn't match 5:4. BlogItem / PortfolioItem stay on object-cover
since those thumbnails are typically photographic with a center subject.
Replaces the fixed `aspect-[5/4]` box + `object-contain` (which letterboxed
the image with a bg-gray tile) with a native `<img>` rendered at
`w-full h-auto`. The listing card now sizes itself to the image's
intrinsic aspect ratio — no cropping, no letterboxing.

Trade-off: gives up next/image's automatic AVIF/WebP and srcset for the
listing thumbnails. ImageKit URLs already serve modern formats based on
Accept headers, and we still apply the right width transform via
resolveListingImage (`?tr=w-600`), so the practical loss is small. The
ComingSoon placeholder keeps the explicit `aspect-[5/4]` since it's a
styled div with no intrinsic dimensions to fall back on.
@ahnafnafee ahnafnafee merged commit 0dc4b0f into main Apr 27, 2026
5 of 6 checks passed
@ahnafnafee ahnafnafee deleted the fix/mobile-issues branch April 27, 2026 01:30
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.

1 participant