[wp-trac] [WordPress Trac] #34678: Responsive Images: Check if content images already have a sizes attribute

WordPress Trac noreply at wordpress.org
Tue Nov 24 08:10:04 UTC 2015


#34678: Responsive Images: Check if content images already have a sizes attribute
----------------------------+------------------------
 Reporter:  jaspermdegroot  |       Owner:  joemcgill
     Type:  defect (bug)    |      Status:  reopened
 Priority:  normal          |   Milestone:  4.4
Component:  Media           |     Version:  trunk
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------------

Comment (by azaozz):

 Replying to [comment:14 joemcgill]:

 I'm also not 100% on what is best but tend to prefer that we treat the
 `srcset` and `sizes` attributes as a group.

 On one side `sizes` is a standard attribute for `<img>` tags and we
 shouldn't restrict the users that want to use it. On the other side it is
 redundant without `srcset`, i.e. it can be considered a user error to have
 `sizes` but not `srcset` in an `<img>` tag.

 > The main concern addressed in r35678 was to ensure we didn't add an
 additional sizes attribute whenever someone had already added a custom
 sizes attribute in the post editor.

 This is also addressed in 34678.2.diff but instead of accepting the
 standalone sizes attr, it bypasses the image tag and doesn't add srcset.
 I.e. keeps the content exactly as the user has entered it.

 > That said, if restricting the use of standalone `sizes` attributes is
 the goal, would we be better off stripping those `sizes` attributes when
 the post is saved?

 Don't think we should remove standalone sizes attributes as they are not
 technically "invalid", they are just "useless". There shouldn't be a
 reason to add them without adding srcset in the first place.

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


More information about the wp-trac mailing list