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

WordPress Trac noreply at wordpress.org
Thu Jun 25 22:54:27 UTC 2020


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

Comment (by azaozz):

 Replying to [comment:14 flixos90]:
 > since this bit was already broken before. For the existing `srcset` and
 `sizes` logic, the code would always rely on the actual file dimensions if
 only one of the two was present...

 It isn't broken for `srcset` and `sizes`, this is the right behavior for
 them :) If both or one is missing, base the sizes attribute on the image
 file dimensions.

 However that's no good for adding the `width` and `height` attributes. The
 logic needs to be extended and this case separated from the srcset and
 sizes use of image file dimensions.

 > > Looking further, there doesn't seem to be a way for a plugin or a
 theme to disable auto-adding of width and height attributes to img tags.
 >
 > I'd question the need for this, what would be the use-case for that?

 At least for consistency if nothing else? This still may be a bit buggy
 when the post_content is used in feeds, emails, etc. Auto-adding HTML
 attributes is fine, but plugins should have a say in it too imho :)

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


More information about the wp-trac mailing list