Skip to content
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

Include non-intersecting elements in URL metrics to fix lazy-load optimization #1293

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

westonruter
Copy link
Member

The Image Prioritizer includes optimization of image lazy-loading, a feature that Optimization Detective (OD) didn't yet implement. The OD plugin only implemented the addition of the fetchpriority=high attribute to the LCP image. Because of this, its intersection observer was only interested in elements which were intersecting. It ignored anything with an intersectionRatio of 0.0. This issue showed up by below-the-fold images having an data-od-unknown-tag attribute, which is also a new feature as of the Image Prioritizer, indicating which tracked elements are absent from the elements in the URL Metrics. By removing the entry.isIntersecting condition, we can ensure that all tracked elements are included in the URL metrics, not just the ones in the initial viewport.

@westonruter westonruter added [Type] Bug An existing feature is broken [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) labels Jun 10, 2024
@westonruter westonruter requested a review from felixarntz as a code owner June 10, 2024 18:10
Copy link

github-actions bot commented Jun 10, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: thelovekesh <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter westonruter changed the title Include non-intersecting elements in URL metrics Include non-intersecting elements in URL metrics to fix lazy-load optimization Jun 10, 2024
@westonruter westonruter requested a review from thelovekesh June 10, 2024 18:11
@westonruter westonruter merged commit 9f95fe2 into trunk Jun 10, 2024
18 checks passed
@westonruter westonruter deleted the fix/intersection-ratio branch June 10, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Image Prioritizer Issues for the Image Prioritizer plugin (dependent on Optimization Detective) [Plugin] Optimization Detective Issues for the Optimization Detective plugin [Type] Bug An existing feature is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants