[wp-trac] [WordPress Trac] #50425: Do not lazy-load images which are very likely to be in the initial viewport
WordPress Trac
noreply at wordpress.org
Tue Jun 30 23:02:47 UTC 2020
#50425: Do not lazy-load images which are very likely to be in the initial viewport
-------------------------------------------------+-------------------------
Reporter: flixos90 | Owner: flixos90
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 5.5
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs-dev- | Focuses:
note |
-------------------------------------------------+-------------------------
Comment (by adamsilverstein):
I tend to agree that the browsers should be deciding exactly how and what
to lazy load, ie. images in the viewport at load should load immediately
regardless of a lazy attribute. It would be interesting to see some data
about how impactful this is.
I tested out the code in https://github.com/WordPress/wordpress-
develop/pull/353 with some recent core themes.
In general for single posts, things worked as expected, only the featured
image at the top of the page excluded the `loading="lazy"` attribute,
inline content images all included it.
I noticed a potential issue however: when I set my home page to show
recent blog post summaries, the themes included the featured image for
each post: these images did lot include the lazy loading attribute.
Similarly, visiting category archive pages showed a list of posts and
these images were not lazy loaded - so I had a long page with images and
none were lazy loaded - not ideal.
After testing I am inclined to agree with @azaozz and feel
`wp_get_attachment_image` should also default to lazy loading. Then we can
clearly document for developers how they can opt out if they need a
different behavior with the `wp_lazy_loading_enabled` filter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50425#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list