Skip to content

Hero: variant-driven video backdrop with poster for LCP#11

Merged
lamontacrook merged 4 commits into
mainfrom
hero-video-poster
Jul 8, 2026
Merged

Hero: variant-driven video backdrop with poster for LCP#11
lamontacrook merged 4 commits into
mainfrom
hero-video-poster

Conversation

@lamontacrook

Copy link
Copy Markdown
Contributor

What

Refactors the hero block so the hero (video) variant plays a video backdrop while keeping the authored image as the LCP poster.

Test URLs

Compare the hero at the top of /en/us:

Changes

  • blocks/hero/hero.js — variant-driven: in the video variant, the first authored image becomes the poster and the first .mp4/.webm URL (link or plain text) becomes the backdrop source. Plain hero stays image-only. Removed the old URL-guessing heuristics and the YouTube/Vimeo embed paths (direct video files only).
  • blocks/hero/hero.css — the video layers over the poster and fades in (is-playing) once it actually plays; dropped the unused iframe-embed rules.
  • styles/styles.css — set main > .section:first-of-type top margin to 38px (small standalone top-of-page spacing tweak requested separately; happy to split it out if you'd prefer).

LCP & accessibility

  • Poster <picture> is promoted to loading="eager" + fetchpriority="high" and is the LCP element.
  • The <video> (muted / loop / autoplay / playsinline) is attached only after the load event, so it doesn't compete with LCP; it fades in once playing (no black-frame flash).
  • Under prefers-reduced-motion: reduce no video is created — the poster remains. If autoplay is blocked, the video element is removed and the poster stays.

Verified locally

  • Desktop: poster eager + fetchpriority=high, video attaches after load and plays (muted/loop/playsinline), content = H1 + subtext + CTA (video-URL paragraph excluded).
  • Reduced-motion emulation: no <video> created, poster still eager.
  • Lint clean.

Note

The "Book Now" CTA is a plain authored link, so it's low-contrast over the bright video (pre-existing). Not changed here — can strengthen the overlay or make it an accent button in a follow-up if desired.

🤖 Generated with Claude Code

lamontacrook and others added 2 commits July 8, 2026 14:01
The `video` variant now uses the authored image as the LCP poster and layers
an authored .mp4/.webm URL on top as a muted, looping, autoplay backdrop. The
poster is loaded eagerly at high priority; the video is attached only after the
page load event to protect LCP, and is skipped entirely under
prefers-reduced-motion or when autoplay is blocked (poster remains). Video is
now gated on the .video variant instead of URL-guessing heuristics; the
YouTube/Vimeo embed paths were removed in favor of direct video files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Jul 8, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

@aem-code-sync

aem-code-sync Bot commented Jul 8, 2026

Copy link
Copy Markdown
Page Scores Audits Google
📱 /en/us PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /en/us PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

A full-bleed autoplay video overtakes the poster as the LCP element on slow
connections (PSI mobile LCP ~9.6s). Limit the video to >=900px viewports on
capable, non-data-saver connections; mobile and constrained clients keep the
eager poster image, which stays the LCP element (~fast). Desktop is unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aem-code-sync
aem-code-sync Bot temporarily deployed to hero-video-poster July 8, 2026 20:06 Inactive
Empty commit to re-trigger the aem-psi-check after a transient desktop
Lighthouse timeout on the previous run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aem-code-sync
aem-code-sync Bot temporarily deployed to hero-video-poster July 8, 2026 20:09 Inactive
@lamontacrook
lamontacrook merged commit 484810c into main Jul 8, 2026
2 checks passed
@lamontacrook
lamontacrook deleted the hero-video-poster branch July 8, 2026 20:09
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