[wp-trac] [WordPress Trac] #62597: WordPress 6.7 sizes="auto" is messing featured image on chrome mobile.

WordPress Trac noreply at wordpress.org
Fri Nov 29 11:16:47 UTC 2024


#62597: WordPress 6.7 sizes="auto" is messing featured image on chrome mobile.
-------------------------------------+-------------------------------------
 Reporter:  maciejmackowiak          |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Post Thumbnails          |     Version:  6.7
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch has-testing-   |     Focuses:  ui, css,
  info has-screenshots               |  administration
-------------------------------------+-------------------------------------

Comment (by sainathpoojary):

 hey @mukesh27,

 I attempted to implement the provided CSS solution:


 {{{
 img:is([sizes="auto" i], [sizes^="auto," i]) {
     contain-intrinsic-size: 3000px 1500px;
 }
 }}}

 However, this resulted in behavior that seems different from what we had
 in WordPress v6.6.1. Here’s the comparison:

 https://utfs.io/f/PL8E4NiPUWyODJv0JdAHytsWpNIfogBi6bRx3aQ5ZFMdLhY1

 But after adding the suggested CSS, this is the current result:

 https://utfs.io/f/PL8E4NiPUWyOqSCREtFX9AiSFV8fHmyxUp5oh3rcqWCNB1LI

 This issue appears to be linked to the fact that we previously set
 `height: auto`, which allowed the image to take its contain-intrinsic-size
 (1500px), as shown in the preview below:

 [[Image(https://utfs.io/f/PL8E4NiPUWyOWfLNaNf7vRTdgHAZJIiLnBPhzUw3Yx4NMe0m)]]

 Also, I noticed some inconsistencies between Firefox and Chrome after
 following the`contain-intrinsic-size` approach:

 [[Image(https://utfs.io/f/PL8E4NiPUWyOW22SLy7vRTdgHAZJIiLnBPhzUw3Yx4NMe0mq)]]

 Although removing height:auto was working as intended because it was
 taking the actual height of the image

 [[Image(https://utfs.io/f/PL8E4NiPUWyOyP17zPurklRUAJtWNBdDhG4x38K5vZL2FHcf)]]

 While the removal of `height: auto` behavior seems to work as expected,
 I’m curious about your thoughts on this. Could there be another approach
 to fix the issue while maintaining consistency across browsers? Any advice
 would be appreciated!

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


More information about the wp-trac mailing list