#5539 - Scan for places we could use lazy loading

This is a spacer post for a website comment topic. The content this topic relates to: #5539 - Scan for places we could use lazy loading
Actually a unit test might not be so easy to do. A better approach would be possibly a standards check or make it a part of the health check for pages.
I think this issue needs a bit more of an explanation as to what is being achieved here. What are we improving by making images load lazily? Performance on the core functionality of the page itself? Reducing bandwidth on mobile devices? Lowering stress on the server?

Adding testing to ensure most things are lazy-loaded seems like a sledgehammer, as it seems to me the decision is more subtle. For example, if you are viewing a gallery image, wouldn't you want that to be prioritized in loading rather than lazy? But something like a news thumbnail, that would make sense to be lazy.

There are more subtle considerations. You shouldn't make an image lazy if you don't have HTML image and width set, because then you get layout shifts which itself hurts performance.

To me this is more a case-by-case optimization thing, than something to fix via some uniformly-enforced standard.
The biggest is page performance and saving bandwidth.

E.g. the theme image screen froze for several seconds while it was loading all the images before I added lazy loading.

Typically anything "below-the-fold" (would not be visible to users immediately because it's further down the page or collapsed in a menu etc) should be lazy-loaded unless as you said it would break layout (but then in that case we could instead have a "skeleton" container until the image loads to maintain structure... this is assuming we know the image dimensions right away which we can usually figure out).
0 guests and 0 members have recently viewed this.