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

WordPress Trac noreply at wordpress.org
Thu Jun 21 17:31:41 UTC 2018


#44427: Introduce lazy-loading API for media and other elements
-----------------------------+-----------------------------
 Reporter:  mor10            |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Media            |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 == Synopsis

 Lazy-loading of media and other elements (iframes, embeds, etc) is a
 performance best practice. Currently, various plugins including Jetpack,
 and themes including WP Rig ship lazy loading features to improve
 performance. These solutions rely on conditionally rewriting the HTML for
 images and other media as it is being loaded from core which is sub-
 optimal.

 == Proposal
 Introduce a lazy-loading API in core which lazy-loads media and other
 elements out of the box based on various conditions, with an opt-out
 feature in the Customizer. This takes the onus of having extensive
 knowledge of performance optimization and how to add lazy-loading to your
 site off the shoulders of the end-user and gives developers control over
 how and when content is lazy-loaded.

 The lazy-loading API should allow theme- and plugin developers detailed
 control over how lazy-loading works. As an example, the AMP plugin would
 disable core lazy-loading and replace it with its own custom method.
 Another example: A theme developer may choose to immediately load the
 featured image of the first post in an index or archive template while all
 other images are lazy-loaded.

 == Why this isn't plugin territory
 Lazy-loading is currently considered plugin territory. I disagree for a
 couple of reasons:

 1. Lazy-loading is performance best-practice:
 https://developers.google.com/web/fundamentals/performance/lazy-loading-
 guidance/images-and-video/.
 2. WordPress should not put the onus on site-owners to have in-depth
 knowledge of performance best-practices and how to meet them.
 3. With no consistent API, plugins and themes may introduce different and
 conflicting solutions to the same problem which in turn causes unexpected
 behavior for the end-user.
 4. Lazy-loading introduced at plugin/theme level forces aggressive
 rewriting of content which would be more consistently performed at core.

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


More information about the wp-trac mailing list