Problem/Motivation
From responsive_image_preprocess_responsive_image():
// Make sure that width and height are proper values
// If they exists we'll output them
// @see http://www.w3.org/community/respimg/2012/06/18/florians-compromise/
if (isset($variables['width']) && empty($variables['width'])) {
unset($variables['width']);
unset($variables['height']);
}
elseif (isset($variables['height']) && empty($variables['height'])) {
unset($variables['width']);
unset($variables['height']);
}
… but those variables never make it into actual HTML. They are not merged into some general attributes array. Nor are they rendered explicitly in the responsive-image.html.twig template.
Proposed resolution
Either support those variables, or remove them. The current documentation is very vague.
Remaining tasks
TBD
User interface changes
None.
API changes
TBD
Data model changes
TBD
Comments
Comment #4
rainbowarrayMy gut feeling is that we should probably make clear that width and height attributes are not appropriate for the img element in a responsive image. I'm not clear why you'd want that at this point.
Comment #8
driverok commentedComment #9
driverok commentedComment #12
jwilson3The width and height values may be appropriate in a responsive image template when, for example a themer needs to calculate an aspect ratio. We may not want to set the actual HTML attributes, but having the variables there should not be deliberately removed.
This may be directly related to, or a duplicate of #3095126: Provide dimensions for the image tag
Comment #13
jwilson3Comment #20
smustgrave commentedI believe this has been resolved by #3192234: Apply width and height attributes to allow responsive image tag use loading="lazy" if someone could double check.
Comment #22
smustgrave commentedSince no follow up, going to close out for now.
If still an issue please reopen, probably updating issue summary