[wp-trac] [WordPress Trac] #44427: Introduce lazy-loading API for media and other elements
WordPress Trac
noreply at wordpress.org
Thu Jun 25 18:43:40 UTC 2020
#44427: Introduce lazy-loading API for media and other elements
-------------------------------------------------+-------------------------
Reporter: mor10 | Owner: flixos90
Type: enhancement | Status: closed
Priority: normal | Milestone: 5.5
Component: Media | Version: 5.4
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests 2nd- | Focuses:
opinion early needs-testing needs-dev-note | performance
-------------------------------------------------+-------------------------
Comment (by flixos90):
In [changeset:"48170" 48170]:
{{{
#!CommitTicketReference repository="" revision="48170"
Media: Ensure images have dimensions to reduce layout shift and facilitate
lazy-loading.
This changeset ensures that attachment images which are inserted without
`width` and `height` attributes still receive them in the frontend, to
reduce cumulative layout shift. Adding the dimensions happens as part of
the logic for adding `srcset` and `sizes` attributes, which already assume
the specific width and height of the respective image.
Images are now only lazy-loaded if they have `width` and `height`
attributes present. While missing these attributes itself is what causes
layout shifts, lazy-loading such images can make this problem more
apparent to the user.
Props adamsilverstein, westonruter.
Fixes #50367. See #44427.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44427#comment:108>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list