[wp-trac] [WordPress Trac] #59638: Images: repeating a single image causes `fetchpriority` to be repeated

WordPress Trac noreply at wordpress.org
Mon Oct 16 20:02:35 UTC 2023


#59638: Images: repeating a single image causes `fetchpriority` to be repeated
-----------------------------+-----------------------------
 Reporter:  adamsilverstein  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Media            |    Version:  trunk
 Severity:  normal           |   Keywords:  dev-feedback
  Focuses:  performance      |
-----------------------------+-----------------------------
 I noticed a small bug in how core auto-applies the `fetchpriority="high"`
 attribute. This feature aims to add this attribute only to the LCP image,
 which is frequently the first large image in a layout.

 The bug is this: if a user inserts a single image several times, every
 instance of the image will have the `fetchpriority="high"` attribute.

 === Steps to reproduce
 1. create a new post
 2. insert a large image at the top of the post
 3. Insert the image several more times, so the post now contains several
 copies of the image.
 4. save and view the post source code

 Expected result:
 The first large image contains the `fetchpriority="high"` attribute.

 Actual results:
 Each copy of the image contains the `fetchpriority="high"` attribute.

 === Notes
 I am posting this here because it feels like a bug, even though I'm not
 sure we should fix it:
 - The image URL for each item is the same so there may be zero impact to
 repeating the attribute (the same URL is prioritized). Unless there is a
 case where the actually fetched image from the srcset could be different
 for two copies of the same image?
 - There could be a slight negative performance impact when fixing this
 since the repetition is the result of an optimization where we only
 consider each unique image once.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59638>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list