Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic lazy loading above the fold, conflicts with <picture> HTML tag #1827

Open
madsenmm opened this issue Oct 8, 2024 · 0 comments
Open

Comments

@madsenmm
Copy link

madsenmm commented Oct 8, 2024

Since the updated of default lazy loading for Liquid image_tag

This conflicts in cases when using preload: true, and rendering images inside a <picture> tag.
If the <picture> element is above the fold, uses preload: true, Shopify forces the <img> element to be loaded, even though if it's viewed on mobile, and should use the <source> value from the <picture> element.

Visual presentation
If the below are viewed on a screensize below the 600px threshold, the img rendered would still be force loaded, but would still want to use the preload feature on desktop.

<!-- First section (index 0) on the page -->
<section>
  <picture>
     <source srcset="..." media="(min-width: 600px)">
     {{- section.settings.image | image_url: width: 300 | image_tag: preload: true -}}
  </picture>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant