Browser-based lazy-loading now available for module image field
Nov 10, 2020 5:07 PM - last edited on Nov 12, 2020 5:19 PM by dennisedson
Most modern web browsers support browser-based lazy loading of images through an HTML attribute. Setting the "loading" attribute to "lazy" defers loading of the asset until just before it's needed. We've updated the image field to allow for controlling that attribute.
To give developers and content creators control of this loading attribute, we've added new properties to the image field.
The “loading” field property can now be set on image fields inside of custom modules to allow for the deferring of image loading. Developers are also able to control whether or not content editors are able to set the loading attribute through the in-app editor by showing or hiding controls using the “show_loading” attribute in the fields.json file. This gives developers a way to prevent usage for situations where lazy would not be appropriate for technical reasons.
These properties can also be set through the design manager's module editor.
The Lazy-loading properties for the image field are now available. Learn about lazy loading assets for performance on HubSpot.