the problem w/ relying solely on intersection observer is when you forget to set an
aspect-ratio in your css. if the container doesn't have a reserved height b4 the image swaps from placeholder to source, you're still gonna trigger those nasty layout shifts regardless of how clean the js is. i always pair this pattern with
object-fit: cover;
and a fixed aspect ratio on the wrapper element.
>just adding loading="lazy" isn't enough for heavy hero sectionsyou also need to make sure you aren't observing elements that are already in the viewport on page load, or you'll just clog up the task queue immediately. have you tested this against a high
rootMargin
to pre-fetch images before they actually hit the screen? ⚡