Problem
When a Picture uses the TACC template override logic that hoists instance.attributes_str to <a> or to <figure>, child templates cannot reliably add a separate class on <img> for the img-only case.
State
Header logo1 needs portal-logo on <img>. Though Core-Styles supports logo having link and not having link (i.e. <img>-only markup), Core-CMS fails to add class="portal-logo" to <img> when logo has no link (or no caption).
Linked header logos (default: home page link) are unaffected.
Cause
taccsite_cms/templates/djangocms_picture/default/picture.html hoists plugin attributes to the parent when link, caption, default caption, or child plugins exist. Otherwise attributes render on <img>. A second class="portal-logo" via picture_attributes_img duplicates class on <img> when attributes are not hoisted; browsers keep one value, so portal-logo is lost.
Reproduction
- Header logo plugin with
portal_logo picture template.
- Remove link (and caption).
- Expect
<img class="… portal-logo"> (or equivalent).
- Observe missing (or incorrect)
portal-logo on <img>.
Context
Problem
When a Picture uses the TACC template override logic that hoists
instance.attributes_strto<a>or to<figure>, child templates cannot reliably add a separateclasson<img>for the img-only case.State
Header logo1 needs
portal-logoon<img>. Though Core-Styles supports logo having link and not having link (i.e.<img>-only markup), Core-CMS fails to addclass="portal-logo"to<img>when logo has no link (or no caption).Linked header logos (default: home page link) are unaffected.
Cause
taccsite_cms/templates/djangocms_picture/default/picture.htmlhoists plugin attributes to the parent when link, caption, default caption, or child plugins exist. Otherwise attributes render on<img>. A secondclass="portal-logo"viapicture_attributes_imgduplicatesclasson<img>when attributes are not hoisted; browsers keep one value, soportal-logois lost.Reproduction
portal_logopicture template.<img class="… portal-logo">(or equivalent).portal-logoon<img>.Context
Footnotes
portal_logotemplate +HeaderLogoPlugin↩