Score:0

How do I apply the `loading="lazy"` attribute to responsive media?

cn flag

On my Drupal 9 installation when I create an "image" field, Drupal automatically adds the loading="lazy" attribute.

When I create a "media" field with an "Adaptive Image Styles" display, the loading="lazy" attribute is not applied.

How to apply the loading="lazy" attribute to responsive media?

If I go to a media image, there is "lazy" :

enter image description here

If I go to a media image with the adaptive image style, there is no "lazy" :

enter image description here

cn flag
If you are using the Blazy contrib module, this sounds like a feature request for that module: https://www.drupal.org/project/issues/blazy
cn flag
@PatrickKenny I don't use a contrib module, it's drupal 9 which adds blazy on all images except for adaptive image styles
id flag
@zoulou66 That is not true. Core adds loading=lazy attribute: https://www.drupal.org/node/3173719
cn flag
@cilefen This is what I want on my images, but it does not add it on the media with the adaptive image style
cn flag
I updated my question, with screenshots to better explain
Score:0
id flag

Wait two weeks for Drupal 9.4.0, which will have this feature.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.