[wp-trac] [WordPress Trac] #53232: Add async decoding attribute as default to the HTML image tags generated by WordPress

WordPress Trac noreply at wordpress.org
Fri May 21 20:13:38 UTC 2021


#53232: Add async decoding attribute as default to the HTML image tags generated by
WordPress
-----------------------------+--------------------------
 Reporter:  isaumya          |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  5.8
Component:  Media            |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:  performance
-----------------------------+--------------------------

Comment (by westonruter):

 OK, I checked with Malte Ubl and he says:

 > Another highly relevant nuance:
 > `decoding=async` does ~nothing on a reasonably sized image, but it is
 impactful on the occasional 20 Megapixel outlier. That page will still
 load slow but the UI thread won't be impacted.
 >
 > If you '''know''' that you're appropriately sizing images, then it
 doesn't really matter what value the `decoding` attribute has. But if you
 don't know (e.g. you are WordPress and you unfortunately don't have image
 optimization build in), then async decoding helps prevent outlier bad
 performance while having effectively no impact on the average page.

 Therefore, this does seem relevant to add to ''all'' images in WordPress
 since it is relatively common for oversized images to be served, where
 image smaller sizes may fail to be generated for the `srcset`. Granted,
 the chance of a 20MB image being added to a post is greatly reduced since
 WordPress 5.3 [https://make.wordpress.org/core/2019/10/09/introducing-
 handling-of-big-images-in-wordpress-5-3/ improved handling of big images].
 Nevertheless, I'm not sure the big image handling is always working. I
 just tried adding a [https://commons.wikimedia.org/wiki/File:CH.SZ
 .Stoos_Fronalpstock_Sequence_Rescue-Helicopter_REGA_16K_16x9-R.jpg 90MB
 image] post and it was added to the post without reduced size or other
 image sizes being created. There probably wasn't enough memory available
 to do any manipulation of the image at all. So this shows that
 `decoding=async` is a useful protection to have enabled by default in
 WordPress.

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


More information about the wp-trac mailing list