Responsive Image loading as "lazy" even though "eager" is set

Created on 30 July 2024, 8 months ago

Problem/Motivation

My banner images are being flagged as lazy loading, and indeed, the tag has loading="lazy" in it, even though I have set the responsive image style specifically to be Eager loading.

Steps to reproduce

Create responsive image display.
Create Media field which uses Responsive image display mode.
Select "Eager" loading, save.
View node, see loading=lazy is in the code.

I was happy when the UI was updated to include this option in the 10.1.x branch [ https://www.drupal.org/node/3279032] β†’ , but somehow, it's not working for me anymore, and I don't know when this happened. I can't find anything in my code that suggests I am using a hook to overwrite or anything.

Thanks.

πŸ› Bug report
Status

Active

Version

10.3 ✨

Component
Responsive imageΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States jennypanighetti

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jennypanighetti
  • πŸ‡ΊπŸ‡ΈUnited States jennypanighetti
  • πŸ‡¬πŸ‡§United Kingdom aaron.ferris

    I can't seem to reproduce this

    1. D10.3
    2. Enable responsive image module
    3. Add an image field to the basic page content type
    4. Configure display for eager, select wide as the responsive image style
    5. Add a new basic page
    6. Upload an image
    7. Save
    8. View

    Markup:
    <img loading="eager" srcset="/sites/default/files/styles/max_325x325/public/2024-08/Screenshot%202024-08-02%20at%2011.16.50.png.webp?itok=_4W86-75 325w, /sites/default/files/styles/max_650x650/public/2024-08/Screenshot%202024-08-02%20at%2011.16.50.png.webp?itok=a4Mnthju 650w, /sites/default/files/styles/max_1300x1300/public/2024-08/Screenshot%202024-08-02%20at%2011.16.50.png.webp?itok=nUqIZ3U5 1300w, /sites/default/files/styles/max_2600x2600/public/2024-08/Screenshot%202024-08-02%20at%2011.16.50.png.webp?itok=ytOjpOFv 2600w" sizes="(min-width: 1290px) 1290px, 100vw" width="325" height="110" src="/sites/default/files/styles/max_325x325/public/2024-08/Screenshot%202024-08-02%20at%2011.16.50.png.webp?itok=_4W86-75" alt="alt text">

    Am I missing a step?

  • πŸ‡¬πŸ‡§United Kingdom aaron.ferris
  • Status changed to Postponed: needs info 8 months ago
  • Thank you for taking the time to test the steps to reproduce. I am updating the issue metadata based on that update.

  • πŸ‡ΊπŸ‡ΈUnited States jennypanighetti

    You're right, `svg_image_formatter` is somehow stripping this value in $attributes. I was getting an empty #attributes array when svg_image_formatter was enabled, but it correctly filled in the loading attribute when it was uninstalled -- even though I'm not using an SVG image.

    I'll open an issue there (if there isn't one already), this can be closed.

Production build 0.71.5 2024