Open bic-ed opened 1 year ago
You got some old tickets here. Yes, the first main image probably does not need lazyloading as this still applies. Sadly just based on the image function itself we do not really know if this is such a main or first image. All image "print" functions would all need an additional parameter to disable lazyloading on request.
Yes, these old tickets were here as reminders, I planned to discuss with the team before I had to abandon everything for a long while. I didn't even had memory of them. :-) About this in particular, I guess the lazyload can be removed at least from the printDefaultSizedImage() function, which is mainly used for the main image of image.php
Probably most themes do use that as the main image. But you cannot be sure what custom stuff anyone really does… And technically this also applies not only to the first main but also first images on a thumb list for example. I think a parameter is the most flexible. I will think about that.
Btw, Google Pagespeed is the better tool probably nowadays being even mobile first. Although all notes should be take as suggestions and not every noted possible problem is really a problem. Same applies to those Core Web VItals.
I think a parameter is the most flexible. I will think about that.
I agree.
Do we really need lazy load for the main image in image.php? It apparently causes a performance downgrade. Perhaps we should either remove it or at least use a parameter to allow themes to skip the attribute. Something like:
printDefaultSizedImage($alt, $class = null, $id = null, $title = null, $image = null, $loading = 'lazy')
Below the screenshots from two GTmetrics report, with and without the loading lazy attribute:
Loading lazy
No loading attribute