Skip to content

Boost: Align Cloud response with plugin for BG Images #43490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: update/boost/link-cloud-sizes
Choose a base branch
from

Conversation

LiamSarsfield
Copy link
Contributor

@LiamSarsfield LiamSarsfield commented May 16, 2025

Note

Merge this PR after #43420 is merged.

Resolves HOG-108: Boost Plugin: Align Cloud response with plugin for BG Images

Proposed changes:

  • This PR supports background images being the LCP for a specific page.
  • It ensures that the preloaded background image is an appropriate responsively set image, while also applying media queries for the viewports we support once the page has fully loaded.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Boost: Improve visitor experience by delivering key images faster - better LCP

Does this pull request change what data or activity we track or use?

N/A

Testing instructions:

Prerequisites

  • Ensure that https://github.com/Automattic/boost-cloud/pull/680 is checked out locally.
  • Latest Boost Developer plugin is installed, and LCP Type is set to Background Image.
  • At least one Cornerstone Page set.
  • Boost Feature Flag enabled within the install (JETPACK_BOOST_ALPHA_FEATURES)
  • LCP Optimization feature enabled.
  • Image Size Analysis disabled.

Apply the following snippet below to test for multiple responsive changes of the LCP Background Image.

Width Changes
add_action('wp_head', function() {
  ?>
  <style>
      #jb-test-lcp {
          width: 100%;
          max-width: 800px;
          height: 400px;
          margin: 0 auto 20px;
          display: block;
          border: 1px dashed #ccc;
          position: relative;
      }

      /* Grows to 360px at 360px viewport */
      @media (min-width: 360px) {
          #jb-test-lcp {
              width: 360px;
              height: 200px;
          }
      }

      /* Grows to 400px at 440px viewport */
      @media (min-width: 440px) {
          #jb-test-lcp {
              width: 400px;
              height: 225px;
          }
      }

      /* Full width at 768px viewport */
      @media (min-width: 768px) {
          #jb-test-lcp {
              width: 768px;
              height: 432px;
          }
      }

      /* Becomes 600px width at 1024px viewport */
      @media (min-width: 1024px) {
          #jb-test-lcp {
              width: 600px;
              height: 337px;
          }
      }

      /* Becomes 400px width again at 1366px viewport (same as 440px) */
      @media (min-width: 1366px) {
          #jb-test-lcp {
              width: 400px;
              height: 225px;
          }
      }

      /* Full width again at 1920px viewport */
      @media (min-width: 1600px) {
          #jb-test-lcp {
              width: 100%;
              height: 1080px;
          }
      }
  </style>
  <?php
});
  1. Enable up Jurassic Tube/Localhost tunnel and login to the public URL available.
  2. Click Optimize on the LCP Feature and wait for it to be completed.
  3. Once completed, open your network tab, and go to a Cornerstone Page.
  4. Filter the network tab, and find the LCP image being fetched. You should notice the Photon CDN URL, with an appropriate width of the image.
  5. Ensure that the image was not requested twice for different widths, as this indicates the BG Media Query, or the preloading is not applying the correct image.
  6. Change the viewport from the dev tools, you should see the LCP image BG URL width is changing in relation to the actual width of the image itself.
  7. When a new width is being requested, refresh the page to ensure that the same width is being requested by the preloading, and it's not being changed once the loading has been finished.

@github-actions github-actions bot added [Boost Feature] Lcp [Plugin] Boost A feature to speed up the site and improve performance. [Status] In Progress labels May 16, 2025
Copy link
Contributor

github-actions bot commented May 16, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Boost plugin:

  • Next scheduled release: May 29, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 16, 2025
Copy link

jp-launch-control bot commented May 16, 2025

Code Coverage Summary

No summary data is available for parent commit dcb8a8b, so cannot calculate coverage changes. 😴

If that commit is a feature branch rather than a trunk commit, this is expected. Otherwise, this should be updated once coverage for dcb8a8b is available.

Full summary · PHP report · JS report

Coverage check overridden by Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR .

@LiamSarsfield LiamSarsfield changed the title Update/boost/link-cloud-sizes-bg Boost: Align Cloud response with plugin for BG Images May 16, 2025
@LiamSarsfield LiamSarsfield added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Status] In Progress labels May 16, 2025
@LiamSarsfield LiamSarsfield requested a review from dilirity May 16, 2025 12:22
@LiamSarsfield LiamSarsfield marked this pull request as ready for review May 16, 2025 12:22
@LiamSarsfield LiamSarsfield requested a review from a team May 16, 2025 12:23
@haqadn haqadn self-assigned this May 21, 2025
@haqadn haqadn marked this pull request as draft May 21, 2025 15:55
@haqadn haqadn marked this pull request as ready for review May 22, 2025 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Boost Feature] Lcp Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR [Plugin] Boost A feature to speed up the site and improve performance. [Status] In Progress [Status] Needs Review This PR is ready for review. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants