Skip to content

Homepage hero: fix SSR hydration flash and portrait desktop layout#667

Merged
Wituareard merged 5 commits intoPauseAI:mainfrom
RisingOrange:fix/hero-picture-breakpoint
Feb 23, 2026
Merged

Homepage hero: fix SSR hydration flash and portrait desktop layout#667
Wituareard merged 5 commits intoPauseAI:mainfrom
RisingOrange:fix/hero-picture-breakpoint

Conversation

@RisingOrange
Copy link
Contributor

@RisingOrange RisingOrange commented Feb 21, 2026

Closes #668

Summary

Fixes two issues with the homepage hero section's image selection and layout logic.

  • Replaces JS-based image switching (isMobile + resize listener) with a native <picture> + <source media> element, so the browser picks the correct image before any JS runs — eliminating the SSR hydration flash on mobile
  • Fixes mobile breakpoint condition from (max-width: 850px), (orientation: portrait) (OR) to (max-width: 850px) (width only), so large portrait windows on desktop (e.g. a half-screen 4K monitor) no longer incorrectly get the mobile layout
  • Updates the desktop scale(0.95) media query to the complement: (min-width: 851px)

Note: landscape mobile did not look great before this PR either — this is a pre-existing limitation, not a regression.

Screenshots

Vertical window on desktop

Before After
Before - vertical desktop After - vertical desktop

Landscape mobile (known limitation)

Landscape mobile

Test plan

  • On mobile portrait: mobile image shown, no flash on load
  • On desktop landscape: desktop image shown with scale(0.95)
  • On a wide portrait window (e.g. half-screen 4K): desktop layout used, not mobile
- Replace JS isMobile/resize listener with <picture> + <source media> so the browser picks mobile vs desktop image natively, eliminating the SSR hydration flash - Change mobile breakpoint from (max-width: 850px), (orientation: portrait) to (max-width: 850px) and (orientation: portrait) so large portrait windows (e.g. half-screen 4K) don't get the mobile layout - Switch object-fit from contain to cover to eliminate the letterbox gap that exposed the CSS background color (fixes Dark Reader two-tone artifact) - Remove transform: scale(0.95) which was adding extra exposed background
- Revert object-fit back to contain (cover was hiding intentional orange background above the image) - Restore transform: scale(0.95) with transform-origin: center bottom - Update scale media query to complement the new mobile condition: (min-width: 851px), (orientation: landscape) instead of the old (min-width: 851px) and (orientation: landscape)
@netlify
Copy link

netlify bot commented Feb 21, 2026

‼️ Deploy request for pauseai rejected.

Name Link
🔨 Latest commit 99430ee
@RisingOrange RisingOrange changed the title Homepage hero: replace JS image switching with <picture>, fix mobile breakpoint Homepage hero: fix SSR hydration flash and portrait desktop layout Feb 21, 2026
@RisingOrange RisingOrange marked this pull request as ready for review February 21, 2026 21:14
@RisingOrange RisingOrange mentioned this pull request Feb 21, 2026
@Wituareard
Copy link
Collaborator

Looks good, I'll approve the preview later and then merge. Thanks!

@Wituareard Wituareard merged commit 88e5a37 into PauseAI:main Feb 23, 2026
5 checks passed
@Wituareard
Copy link
Collaborator

Thanks!

@RisingOrange RisingOrange deleted the fix/hero-picture-breakpoint branch February 23, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants