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

WordPress Trac noreply at wordpress.org
Tue Jul 31 07:37:44 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           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by jonoaldersonwp):

 - Agreed on requiring explicit theme support.
 - Agreed on only catching common/reasonable use-cases (e.g., `<img>` tags
 and `get_attachment_` derivatives)
 - Suggest we ignore background images (for now), as this adds a ton of
 additional complexity and overhead.
 - Agree on `data-` attributes (and/or a class name) for skipping lazy
 load, and for a checkbox against the media entity.

 So, specifics:
 - We need to agree on a theme support hook. I propose `lazy-load-images`
 for some additional specificity, as we might also do something with `lazy-
 load-{{other}}` in the future.
 - We need a checkbox against all media where the mime type is of an image
 format and the wording around that. E.g., "Disable lazy-loading for this
 image".
 - We need to agree a `data-` attribute or class name for skipping lazy
 load. Agreed on `data-skip-lazy-load`. Whilst I'd prefer an attribute, my
 gut feeling is that might be a little foreign to most content editors and
 some theme developers; whereas a class (`skip-lazy-load`) might be a more
 recognisable approach. No reason we can't support both.
 - We need to identify the `get_attachment_` functions which return image
 HTML (as opposed to attributes) and assess the impact of filtering the
 output of these.
 - Update relevant documentation.
 - Build the thing.

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


More information about the wp-trac mailing list