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

Use scrollMargin for lazy load intersection observer #9932

Merged
merged 2 commits into from
Nov 16, 2023

Conversation

tcaptan-cr
Copy link
Contributor

@tcaptan-cr tcaptan-cr commented Nov 15, 2023

Currently the lazy load intersection observer is set up using a rootMargin. This does not work well for pages that use images in CSS scrollers, like carousels, causing the images to load too late, when they become visible and the intersection with the root is detected. To work around this issue some developers are choosing to not use lazy loading, thus increasing the overall bandwidth usage for their sites.
This problem was discussed in issue 431.

Using scrollMargin for the lazy load intersection observer will allow lazy loading images in scrollers to load when they are near the viewport as expected.


/acknowledgements.html ( diff )
/urls-and-fetching.html ( diff )

Currently the lazy load intersection observer is set up using a rootMargin.
This does not work well for pages that use images in CSS scrollers, like
carousels, causing the images to load too late, when they become visible
and the intersection with the root is detected. To work around this issue
some developers are choosing to not use lazy loading, thus increasing the
overall bandwidth usage for their sites.

Using scrollMargin for the lazy load intersection observer will allow lazy
loading images to load when they are near the viewport as expected.
@tcaptan-cr
Copy link
Contributor Author

PTAL @emilio @zcorpan @smfr

Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Not an editor, but the intent looks good.

source Show resolved Hide resolved
@zcorpan zcorpan merged commit f0e365c into whatwg:main Nov 16, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants