[wp-trac] [WordPress Trac] #44427: Introduce lazy-loading API for media and other elements

WordPress Trac noreply at wordpress.org
Thu Jan 9 21:01:54 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 peterwilsoncc):

 Replying to [comment:76 westonruter]:
 > What if we restrict adding adding `loading=lazy` by default to just
 images that are being loaded from the install's `uploads` directory? This
 will avoid scenarios where we accidentally lazy-load images that are being
 used for tracking purposes, which would generally be pointing to some
 external domain or to some REST API endpoint.

 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.

 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.

 Due to the high usage of WordPress, adding the attribute by default in
 certain cases needs to be considered carefully as there is a risk the
 cowpath (to use @mor10's term above) set defeats the intended purpose of
 the attribute.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44427#comment:79>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list