HTML5 spec lazy-loading that sets correct aspect ratios..
Related to
https://www.vaultwiki.org/issues/6258/ that was more or less ignored...
Re-raising this because "above the fold" images don't always load with the current lazy-loading implementation (when images are not in cache, on the second refresh they load...)
Also, doing lazy-loading with JS is prone to errors, and browsers will actually handle these things better themselves...
------
We should have an option for lazy loading that follows the HTML5 spec without using JS... Inserting width and height with JS is not a good idea...
loading="lazy" is supported by all modern browsers, and recommended...
https://web.dev/browser-level-image-lazy-loading/
the CSS "aspect-ratio" is also supported, and allows us to get the correct aspect ratio while still allowing us to limit CSS height/width attributes.
https://developer.mozilla.org/en-US/...S/aspect-ratio
With the proposed "HTML5-spec lazy loading"-option selected, the following should be done for all images
Note: This all happens on the server side :
- Set loading="lazy"
- Set width="<X>"
- Set height="<Y>"
- Set style="aspect-ratio: <X>/<Y>"
With this, the aspect ratio and image sizes will flow correctly without having FOUC or similar jumpiness, and browsers will handle the lazy-loading part.
If I then want to set specific width/height limitations, I can do so in the CSS, and the content will flow correctly, provided I set either the width or height attr to "auto"...
Can we please get this prioritized? I feel like this is such a low-hanging fruit to actually get best-practice lazy-loading implemented
