[wp-trac] [WordPress Trac] #59641: manually setting fetchpriority on image should prevent core from adding fetchpriority attribute

WordPress Trac noreply at wordpress.org
Mon Jun 3 15:15:36 UTC 2024


#59641: manually setting fetchpriority on image should prevent core from adding
fetchpriority attribute
-----------------------------+--------------------------
 Reporter:  adamsilverstein  |       Owner:  (none)
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Media            |     Version:  6.3
 Severity:  normal           |  Resolution:  worksforme
 Keywords:  needs-patch      |     Focuses:  performance
-----------------------------+--------------------------
Changes (by adamsilverstein):

 * status:  new => closed
 * resolution:   => worksforme
 * milestone:  6.6 =>


Comment:

 I did some further testing on this issue.

 I created a test post where a small grid of thumbnails proceeds a large
 image. On desktop, this image is the LCP element and by default core does
 a very poor job of tagging this layout. the first thumbnail (which is
 actually sized "medium") get fetchpriortity="high" and the large image
 gets loading="lazy"  - pretty much the opposite of what we want! see
 [attachment:"fetchpriority problem.jpg"]. [https://fetchpriority-
 test.instawp.xyz/fetchpriority-test-1/ Test post].

 Next I created the same layout, but editing the page code I manually
 edited the page to add fetchpriority manually to the large image. Viewing
 the [https://fetchpriority-test.instawp.xyz/fetch-priority-test-2/ new
 test post] I see that the fetchpriority is in the correct place, the first
 image no longer gets the fetchpriority="high" and the LCP image no longer
 gets the loading="lazy". See [attachment:"manual fetch priority on large
 image.jpg"]

 To summarize, the issue I was seeing here was an artifact of adding
 fetchpriority via the block_render hook. Once I tested adding the
 attribute to the markup manually, core behaved as expected. Any fix is
 probably appropriate in the upstream plugin.

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


More information about the wp-trac mailing list