Skip to content

[Content Type Image] Both desktop and mobile images are loaded #254

Open
@jasperzeinstra

Description

@jasperzeinstra

When using Content Type Image and using a mobile and desktop image both images are loaded by the browser. It should only load the image you see. The template is now using two img-tags. But it would be better to use the picture-tag.

Current situation
vendor/magento/module-page-builder/view/adminhtml/web/template/content-type/image/full-width/master.html

<figure>
  <a>
    <img src="…" class="pagebuilder-mobile-hidden" />
    <img src="…" class="pagebuilder-mobile-only" />
  </a>
  <figcaption>…</figcaption>
</figure>

Preferred situation

<figure>
  <a>
    <picture>
      <source media="(min-width: 678px)" srcset="…">
      <source media="(max-width: 677px)" srcset="…">
      <img src="…" />
    </picture>
  </a>
  <figcaption>…</figcaption>
</figure>

I haven't figured out how page builder works exactly so haven't got a PR ready for this. But does everybody agree that this is a better implementation? Otherwise you're loading desktop images on a mobile device. That's taking up to much resources.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itblockedstory

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions