Home Forums WoodMart support forum Woodmart lazy loading implementation

Woodmart lazy loading implementation

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #345091

    horny_fungus
    Participant

    Hi, I noticed several big problems with Woodmart implementation of lazy loading:
    – product images are always lazy loaded with priority set to low. This can affect single product page very badly and increase LCP time significantly. Images in the viewport should not be lazy loaded at all.
    – For Woodmart sliders two first images are always loaded regardless of the slider placement on the page. So even if it’s deep under the fold first image will be loaded with priority high and second will be loaded with priority low during initial page load.

    #345150

    Artem Temos
    Keymaster

    Hello,

    1. If you are talking about WordPress native lazy loading feature then we don’t control the priority in our theme for any of the images.

    2. Unfortunately, it is not possible to recognize whether is the slider is in the viewport or not when generating its output in PHP.

    Kind Regards

    #345429

    horny_fungus
    Participant

    Regarding your points:
    1) I am talking about what I see when I switch on Woodmart lazy loading option. I am not sure how your implementation interacts with WP lazy loading. I can see with my eyes that single product page product images are loaded later when lazy loading is enabled, it is seen even better when throttling is applied.
    2) So maybe we should be able to fine tune this manually? Add some class to exclude the slide or whole elemnt from lazy loading?

    In general I see several problems here:

    1) Single Product Page. First product image is very important content directly affecting LCP and should be loaded as early as possible, but currently it is loaded comparably late even without lazy loading. Here’s a screenshot from your demo site with clarification – https://paste.pics/06b3b84937b4585be56e1f66b839be26

    2) Woodmart Lazy Loading. All images are lazy loaded, even those which are in initial viewport. BTW WordPress is trying to implement now some mechanism to exclude above the fold images from lazy loading – https://make.wordpress.org/core/2021/12/29/enhanced-lazy-loading-performance-in-5-9/. At least on single product page you should be able to exclude first one or two product images as we know which they are.

    3) Woodmart Lazy Loading. All images are lazy loaded with resource priority set to low which can further worsen the situation for above the fold content.

    #345430

    Artem Temos
    Keymaster

    Hello,

    1. Our lazy loading system doesn’t have any priorities. Images are loaded once they are visible in the viewport.

    2. Do you mean to add on/off option for the slider to load first two slides initially? It does make sense. We will consider this.

    Kind Regards

    #345436

    horny_fungus
    Participant

    1. But images get low priority somehow – https://paste.pics/2e8b30c9819119800a0578d8c736d414

    2. Yes, something like this. In most cases slider position is known, so user can decide if initial loading of slides makes sense.

    Maybe including particular lazy loading option like for Products (grid or carousel) element would make sense. If I understand correctly how it works, it has higher priority than general lazy loading option and lazy loads element even if lazy loading is disabled in general.

    #345810

    Artem Temos
    Keymaster

    1. This priority is set by the browser, not by the theme. We can’t change this in our theme.

    2. No, it doesn’t work like that. Doesn’t matter if you set the lazy loading globally or for particular elements. The result will be the same.

    #347422

    horny_fungus
    Participant

    I want to return to the problem of lazy loading of first image.
    It’s rather important, as currently there’s no optimal solution:
    – when Woodmart lazy loading is enabled first image loading is postponed which leads to worse LCP time
    – when Woodmart lazy loading is disabled native browser lazy loading does not handle consecutive product images on single product page, so they are loaded only when user clicks arrow button (problem with single product page described here – https://xtemos.com/forums/topic/product-gallery-images-loaded-only-on-click/#post-347340). I am not quite sure why it happens as with default themes usually all carousel images are loaded immediately.

    Can you please describe in more details how wd-lazy-load class is applied? I tried to adopt following code – https://stackoverflow.com/a/65326178/12100478 to remove the class from first images but with no success, it seems like the class is added via JS as I can’t remove it via PHP snippet.
    Also WordPress introduced some mechanism to avoid lazy loading for first image in WP 5.9 – https://make.wordpress.org/core/2021/12/29/enhanced-lazy-loading-performance-in-5-9/
    So maybe you should examine these solutions and develop something similar for Woodmart?

    #347426

    Artem Temos
    Keymaster

    Hello,

    Our wd-lazy-load class is applied in PHP to all images if you enable our WoodMart lazy loading function. Then, JS adds another class when this image is in the viewport to load the original image.
    We will review this mechanism but it is related to WordPress lazy loading and not to our theme’s one.

    Kind Regards

Viewing 8 posts - 1 through 8 (of 8 total)