Skip to content

frontend(fix): let the hero H1 rise without fading so it counts as LCP - #583

Merged
Ducksss merged 1 commit into
mainfrom
claude/affectionate-margulis-c3ab94
Oct 1, 2026
Merged

Ducksss merged 1 commit into
mainfrom
claude/affectionate-margulis-c3ab94

Conversation

@Ducksss

@Ducksss Ducksss commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #523.

The landing <h1> now uses hero-rise instead of hero-reveal: the same 16px rise, 520ms curve, and 60ms delay, but no opacity fade. The headline is opaque from its first frame. The eyebrow, subheadline, install command, and links keep hero-reveal and their 0–190ms stagger.

  • src/app/globals.css adds the hero-rise keyframes and a .hero-rise class next to hero-reveal.
  • src/components/site/sections/HeroSection.tsx swaps the H1's class.

What the measurement found

The issue expected the fade to delay LCP by about its own length. It was worse than that: Chrome didn't count the faded H1 at first paint at all.

  • Chrome skips text painted at opacity 0 when it picks the LCP element. The fade runs on the compositor and never repaints the text, so the H1 isn't counted when it becomes visible.
  • On a phone the header shows only the logomark, and every line of hero text fades in, so nothing in the first viewport could be counted at first paint. On a throttled phone the first LCP entry came about 950ms later, when the Geist web font arrived and repainted the H1, which was opaque by then. With web fonts blocked, the old build logged no LCP entry at all on mobile. The fixed build logs the H1 at first paint either way.
  • On desktop nothing repainted the H1 after first paint, so it was never counted. LCP fell back to the largest text that doesn't fade. For first-time visitors that was the consent banner's paragraph, rendered after hydration. For returning visitors it was the 15px header wordmark.
  • The issue's other option, zero delay and a 120ms fade on the H1 only, measured the same as before everywhere. The H1's first frame is still at opacity 0.

LCP before and after

Times are in ms: the median, with p75 in brackets, over 20 interleaved cold loads per build. Δ is the paired median difference with its 95% bootstrap CI.

Scenario Before After Δ (95% CI) LCP element, before → after Other option (0ms delay, 120ms fade)
Desktop 1440×900, first visit 212 (216) 136 (145) −72 (−76 to −66) banner <p> → H1 212, Δ 0 (−4 to 6)
Desktop 1440×900, returning (no banner) 152 (168) 144 (153) −4 (−14 to 4) header wordmark → H1 142, Δ −2 (−16 to 8)
Mobile 390×844, first visit 2244 (2252) 1290 (1327) −960 (−970 to −946) H1 → H1 2242, Δ +6 (−12 to 12)
Mobile 412×823, first visit 3188 (3250) 3158 (3307) −12 (−44 to 26) banner <p> → banner <p> 3174, Δ −14 (−62 to 6)
Mobile 412×823, returning (no banner) 2262 (2281) 1296 (1326) −966 (−986 to −950) H1 → H1 2246, Δ −16 (−26 to 2)
  • Mobile: LCP drops about 960ms wherever the H1 is the largest element.
  • Desktop: the gains are small: −72ms on a first visit and none on a return visit. The fallback text painted at first paint or just after it. The bigger difference is that the metric now tracks the headline rather than the banner or the wordmark.
  • 412px first visit: the only case that doesn't improve. There the consent banner is the LCP element either way (see Notes).
When the H1 itself was counted
Scenario Median FCP, before / after H1 counted at, before H1 counted at, after
Desktop 1440×900, first visit 136 / 136 never (0/20) first paint (20/20)
Desktop 1440×900, returning (no banner) 152 / 144 never (0/20) first paint (20/20)
Mobile 390×844, first visit 1284 / 1290 FCP + 956ms (median) first paint (20/20)
Mobile 412×823, first visit 1312 / 1304 FCP + 962ms (median) first paint (20/20)
Mobile 412×823, returning (no banner) 1318 / 1296 FCP + 956ms (median) first paint (20/20)

Method:

  • Builds: three production builds, all pnpm build:e2e then next start, served side by side:
    • origin/main
    • this branch
    • the issue's other option (zero delay and a 120ms fade on the H1 only)
  • Loads: each load is cold, in a fresh browser context, after 2 warm-ups per build. The build order rotates every iteration.
  • Browser: headless Chromium 151 via Playwright.
  • LCP: read from a buffered PerformanceObserver('largest-contentful-paint') once the page settles, meaning 1.5s after the consent banner appears, or 3–4s when there's no banner.
  • Mobile: Lighthouse's Moto G Power form factor (412×823 at 1.75x, plus a 390px iPhone-width variant), with 4× CPU and 150ms RTT / 1.6 Mbps throttling applied through CDP.
  • Desktop: 1440×900, unthrottled.
  • Returning: a stored consent choice is set before load, so no banner renders.
  • Analytics: blocked in the network stack, so the runs sent no events.

Verification

  • pnpm test:release: not run in full locally; CI runs the gate. Run locally:
    • pnpm lint, pnpm exec tsc --noEmit, and Prettier on both files pass.
    • pnpm run test:int: 64 files, 794 tests passed (1 file and 1 test skipped).
    • PLAYWRIGHT_SERVER_MODE=production pnpm test:e2e tests/e2e/frontend.e2e.spec.ts tests/e2e/a11y.e2e.spec.ts, against a pnpm build:e2e build: 171 passed, and 1 was skipped: the landing screenshot contract, which only runs on Linux. One more, the /docs/components/content-rows route smoke check, hit the 180s timeout inside its grantConsent beforeEach hook (a single addInitScript call) before it loaded the page. It passed on an isolated rerun in 5.1s.
  • Baselines should be unchanged. I captured the landing page the way landing page keeps its desktop and mobile visual contract does: consent granted, reduced motion, animations: 'disabled', full page, at 1280×720 and 390×900. I took two captures from each build, then repeated the set with the consent banner showing.
    • Before vs after differs by 0 pixels at both 1280×10610 and 390×17937 in every set, and the page heights match. The noise floor within each build is also 0 pixels.
    • Both builds settle on the same frame (opacity: 1, translateY(0)), so landing-home-*-chromium-linux.png shouldn't need a re-mint. The Linux release-gate on this PR compares against them. If it flags a difference, the mint goes through visual-baselines.yml.
  • The look is kept. I paused every hero animation at t = 0, 60, 120, 200, 320, and 700ms and captured the hero.
    • Before: the headline is invisible until 60ms, then fades in.
    • After: it's readable from frame 0 and makes the same rise.
    • Everything else: at each sampled time, the only pixels that differ between the builds are inside the headline's box, and at 700ms the frames are identical.

Registry Checklist

  • Registry changes keep generated public/r output out of git. (No registry changes.)
  • Component changes update source, manifest, docs, and installer tests together. (No component changes.)
  • Payload target code keeps Local API and hook examples transaction-safe. (No target code touched.)

Notes

  • Mobile first visits are still held back by the consent banner (out of scope here). At 360, 412, and 430px the banner's paragraph is slightly larger than the H1: 34,500 vs 33,746 px² at 412px. It paints after hydration, about 1.9s after first paint on a throttled phone, and is the final LCP element with or without this change. At 375–393px and at 768px and wider, the H1 stays the LCP element. It's consent copy, so it needs its own decision.
  • /about and /brand-guide still fade their H1s in. Both use hero-reveal, with a 180ms delay on the H1 and 340ms on the lead paragraph. That's the same guardrail breach, left for a follow-up that can reuse .hero-rise.
  • The design essay needs no change. The fix matches its motion principle ("Motion confirms; it never gates."), so no decision-ledger entry changes.

🤖 Generated with Claude Code

The landing H1 used hero-reveal, an opacity-and-rise entrance. Chrome
skips text painted at opacity 0 when it picks the LCP element, and the
fade runs on the compositor without repainting the text, so the H1 was
not counted when it became visible. On desktop it was never counted and
LCP fell back to the consent banner or the header wordmark. On a
throttled phone it only counted when the web font swapped in, about
950ms after first paint.

The H1 now uses hero-rise: the same 16px rise, 520ms curve, and 60ms
delay without the fade, so it is the LCP element at first paint. The
rest of the hero keeps hero-reveal and its stagger. Both entrances end
on the same frame, so the landing visual baselines are unaffected; the
settled landing captures differ by 0 pixels at both snapshot sizes.

Measured on production builds in Chromium 151, median LCP went from
2244ms to 1290ms on a throttled 390px phone and from 212ms to 136ms on
desktop (first visits).

Closes #523

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 30, 2026 18:44
@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
payload-components Ready Ready Preview Sep 30, 2026 6:47pm UTC
payload-components-97bf Ready Ready Preview Sep 30, 2026 6:47pm UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: Ducksss/payload-components/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 185299be-c5e6-41e7-8462-6d870e6d1c7a

📥 Commits

Reviewing files that changed from the base of the PR and between ac916f5 and c1e0c8e.

📒 Files selected for processing (2)
  • src/app/globals.css
  • src/components/site/sections/HeroSection.tsx
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Ducksss
Ducksss merged commit 6072a19 into main Oct 1, 2026
17 of 19 checks passed
@Ducksss
Ducksss deleted the claude/affectionate-margulis-c3ab94 branch October 1, 2026 11:38
Ducksss added a commit that referenced this pull request Oct 4, 2026
…bile LCP (#598)

On a first visit at 360-430px, the consent banner's description paragraph
could out-size the landing H1. Because the banner paints after hydration, it
then became the final LCP entry, about 3.4s on a throttled phone. Since #583
the H1 is opaque from first paint. A tighter description keeps the banner below
the H1's area, so LCP stays at first contentful paint.

The new copy keeps all four disclosures: which tools, why, what Decline does,
and what runs regardless. It replaces the static-HTML banner approach in #590,
which reached about 2.6s with 576 added lines.

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

2 active deployments
Preview – payload-components-97bf — c1e0c8e9 Deployed Sep 30, 2026 by vercel[bot]
Preview – payload-components — c1e0c8e9 Deployed Sep 30, 2026 by vercel[bot]
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.

landing: decide the hero H1 entrance vs the no-LCP-fade guardrail

2 participants