- Open on Drupal.org βCore: 10.1.4 + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Waiting for branch to pass
When the "Prefer native lazy-loading" box is checked, the "loading" attribute is properly used; however, it has come to my attention that if we're on a browser that does not have native lazy loading available (e.g. Firefox < 75/Chrome < 77/IE <= 11, see https://caniuse.com/loading-lazy-attr), there is no feature detection in use to instead use the JavaScript-based approach. Correct me if I'm wrong, but the prefer native option seems to not necessarily prefer native, but actually insists upon it -- breaking lazy loading for browsers that do not support it natively.
Should we not be doing a more accurate feature detection for the current browser in order to determine if the user's browser supports lazy load, then adjust rendering accordingly? Since this is all happening server-side perhaps this is not possible?
Add more accurate feature detection when selecting the prefer native option. If the browser is determined to support native lazy loading, use the loading="lazy" attribute, otherwise adjust the markup to leverage the lazysizes JS.
Needs work
3.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.