[wp-trac] [WordPress Trac] #44427: Introduce lazy-loading API for media and other elements
WordPress Trac
noreply at wordpress.org
Thu Jan 9 21:40:21 UTC 2020
#44427: Introduce lazy-loading API for media and other elements
-------------------------------------------------+-------------------------
Reporter: mor10 | Owner: flixos90
Type: feature request | Status: assigned
Priority: normal | Milestone: 5.4
Component: Media | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests 2nd- | Focuses:
opinion | performance
-------------------------------------------------+-------------------------
Comment (by azaozz):
Replying to [comment:79 peterwilsoncc]:
> My understanding is that adding `loading=lazy` to all images can be just
as problematic, or potentially more so, than not using the attribute.
Images within the view port ought not use the attribute while images below
the fold ought to.
>
> [https://developers.google.com/web/fundamentals/performance/lazy-
loading-guidance/images-and-video#what_can_go_wrong A Google performance
article on lazy loading] discusses some of the risks with lazy loading,
although it's a little out of date and focuses on JavaScript technique I
belive the same risks exist with the native techniques.
As @westonruter points out my understanding is that using the (new) img
tag attribute "removes" these concerns. It lets the browser decide when to
lazy-load, it does not "disable" the img tags like the js methods.
Form @addyosmani's [https://addyosmani.com/blog/lazy-loading/ introductory
post]:
The loading attribute allows a browser to defer loading offscreen images
and iframes until users scroll near them. loading supports three values:
-- lazy: is a good candidate for lazy loading.
-- eager: is not a good candidate for lazy loading. Load right away.
-- auto: browser will determine whether or not to lazily load.
> Additionally, and this is opinion rather than science based, in some
cases the images are the primary content (attachment pages, posts that
only contain a gallery/photo) so I'd argue these should be loaded
normally.
Right, but in (almost?) all of these cases these "high-priority" images
are also visible in the initial viewport. As I mentioned above, it makes
sense to "examine" the interactions between importance, decoding, and
loading. Seems any high-priority images should have `importance="high"`
set, whether that affects lazy-loading or not.
@peterwilsoncc what do you think about the idea to make this into a
(featured) plugin and attempt to promote more user testing? I'm pretty
sure there will be some large/busy sites that may want to participate in
such tests :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44427#comment:81>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list