[wp-trac] [WordPress Trac] #50367: Avoid layout shifting due to images not having dimension attributes
WordPress Trac
noreply at wordpress.org
Thu Jun 25 22:59:52 UTC 2020
#50367: Avoid layout shifting due to images not having dimension attributes
-------------------------------------------------+-------------------------
Reporter: flixos90 | Owner: flixos90
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 5.5
Component: Media | Version:
Severity: normal | Resolution:
Keywords: needs-testing has-patch has-unit- | Focuses:
tests needs-dev-note |
-------------------------------------------------+-------------------------
Comment (by flixos90):
Replying to [comment:18 azaozz]:
> It isn't broken for `srcset` and `sizes`, this is the right behavior for
them :) If both or one is missing, base the sizes attribute on the image
file dimensions.
Ah right, sorry I had something wrong in my thoughts there :D Yeah in this
case, makes certainly sense to address this here.
> > I'd question the need for this, what would be the use-case for that?
>
> At least for consistency if nothing else? This still may be a bit buggy
when the post_content is used in feeds, emails, etc. Auto-adding HTML
attributes is fine, but plugins should have a say in it too imho :)
We could make it a separate function as @joemcgill suggested, this way
plugins could unhook it. The important thing here is we need to have it
apply before `wp_image_add_srcset_and_sizes`.
@joemcgill @youknowriad Agreed regarding a dev-note, I was planning to
incorporate it in the one for #44427, since these changes are closely
related. We could expand the scope for the dev note a bit covering not
only lazy-loading, but generally modifying image tags on the fly via
`wp_filter_content_tags()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50367#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list