Changes the lazy load intersection observer's init dictionary to use a scrollMargin instead of a rootMargin. This allows lazy loading images contained inside CSS scrollers, like carousels, to load as expected when near the viewport instead of the current behavior where these images load when at least one pixel is intersecting the viewport.
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 github issue 431 (https://github.com/w3c/IntersectionObserver/issues/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.
Overall low as scroll margin also applies to the root element thus not affecting lazy loading images that are currently loading with just a root margin.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
None
None
This feature is behind an enabled-by-default flag that can be disabled if needed.
Shipping on desktop | 121 |
DevTrial on desktop | 121 |
Shipping on Android | 121 |
DevTrial on Android | 121 |
Shipping on WebView | 121 |