Shopify / Shopify/liquid

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

Open
#1,827 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

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>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Liquid image_tag example with a picture element at widths below and above the 600px threshold, comparing preload behavior and source selection. Trace the default lazy-loading and preload handling for image_tag; done means the mobile source is used without forcing the img element while desktop retains preload behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, ruby
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.