[wp-trac] [WordPress Trac] #50367: Avoid layout shifting due to images not having dimension attributes

WordPress Trac noreply at wordpress.org
Fri Jun 12 00:47:58 UTC 2020


#50367: Avoid layout shifting due to images not having dimension attributes
--------------------------------------+-----------------------
 Reporter:  flixos90                  |       Owner:  flixos90
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  5.5
Component:  Media                     |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------

Comment (by flixos90):

 Replying to [comment:5 adamsilverstein]:
 > This feels like a great improvement: one question though - why are these
 images missing the width/height in the first place when inserted with the
 block editor? I'm guessing this is discussed on the issue you linked, I
 haven't read the entire thing :)

 Yes, it's indeed mostly due to a regression that the block editor
 introduced; at the moment, `width` and `height` attributes are only added
 if the user manually resizes the image (i.e. if they differ from the
 actual image dimensions). This use-case is covered here as the image
 dimensions wouldn't be added then.

 > For now though, many users are sure to have created content that
 includes image tags lacking width/height attributes. This change will
 likely provide measurable improvements in reducing cumulative layout shift
 for these sites. Let's get this in before 5.5 beta so it can get some
 wider testing.

 That's a good point, it's another reason this fix in itself is useful even
 once the issue gets addressed in Gutenberg (which we should totally do as
 well).

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


More information about the wp-trac mailing list