[wp-trac] [WordPress Trac] #61847: Auto Sizes for Lazy-loaded Images

WordPress Trac noreply at wordpress.org
Mon Nov 18 19:50:22 UTC 2024


#61847: Auto Sizes for Lazy-loaded Images
-------------------------------------------------+-------------------------
 Reporter:  mukesh27                             |       Owner:  joemcgill
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.7
Component:  Media                                |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests needs-dev-  |     Focuses:
  note                                           |  performance
-------------------------------------------------+-------------------------

Comment (by flixos90):

 In [changeset:"59415" 59415]:
 {{{
 #!CommitTicketReference repository="" revision="59415"
 Media: Avoid images with `sizes=auto` to be displayed downsized in
 supporting browsers.

 Based on the user agent stylesheet rules outlined in
 https://html.spec.whatwg.org/multipage/rendering.html#img-contain-size,
 images that have `sizes=auto` while applying `width: auto` or `width: fit-
 content` would be constrained to only 300px width.

 This changeset overrides said user agent stylesheet rule with a much
 larger constraint, to avoid the problem.

 Additionally, it introduces a filter `wp_img_tag_add_auto_sizes` which can
 be used to opt out of the functionality, as an additional measure.

 Props joemcgill, flixos90, dooperweb, SirLouen, azaozz, mukesh27, apermo.
 Fixes #62413.
 See #61847, #62345.
 }}}

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


More information about the wp-trac mailing list