[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 Oct 29 15:46:44 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.9
Component:  Media            |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:  performance
-----------------------------+--------------------------

Comment (by westonruter):

 @isaumya It's actually not a best practice to add `loading=eager` to the
 first image, and to instead opt to just omit the `loading` attribute
 altogether. The reason for this is that in Chrome, for example, omission
 of the attribute implies that the browser should decide whether to lazy-
 load (e.g. based on the network connection). However, if you add
 `loading=eager` then it will download it unconditionally. See caution in
 [https://web.dev/browser-level-lazy-loading-for-cmss/ Browser-level lazy-
 loading for CMSs]:

 > If an element should not be lazy-loaded, require or encourage skipping
 the `loading` attribute entirely. While using `loading="eager"` is a
 supported alternative, this would tell the browser explicitly to always
 load the image right away, which would prevent potential benefits if
 browsers implemented further mechanisms and heuristics to automatically
 decide which elements to lazy-load.

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


More information about the wp-trac mailing list