[wp-trac] [WordPress Trac] #59464: Images in 2024 theme do not have modern image features

WordPress Trac noreply at wordpress.org
Tue Sep 26 21:50:23 UTC 2023


#59464: Images in 2024 theme do not have modern image features
--------------------------+--------------------------
 Reporter:  spacedmonkey  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  6.4
Component:  Themes        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  performance
--------------------------+--------------------------
Changes (by flixos90):

 * keywords:  has-patch =>


Comment:

 After looking into this, unfortunately it seems that this bug cannot be
 fixed without having the image displayed incorrectly within the block
 editor. 😞

 The only way to add `width` and `height` attributes to the hard-coded
 blocks in the TT4 theme is to add the `width` and `height` attributes to
 the block as well, as well as the `is-resized` class to the `figure` tag
 around the image - otherwise this is invalid `core/image` block markup.

 That is easily possible to accomplish, however apparently the image will
 then display incorrectly ''within'' the block editor only. In the frontend
 it still looks fine. So in order to fix this in a way that works for both
 the frontend and the editor, we'll probably need to allow width and height
 attributes on the image decoupled from ''enforcing'' a specific image
 size.

 Last but not least, even after adding the `width` and `height` to the
 block, for some reason the image still doesn't have the loading
 optimization attributes present. 🤔

 See https://github.com/WordPress/wordpress-develop/pull/5323 for testing.

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


More information about the wp-trac mailing list