Skip to content

portal-logo class missing on <img>-only header logo #1185

@wesleyboar

Description

@wesleyboar

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

  1. Header logo plugin with portal_logo picture template.
  2. Remove link (and caption).
  3. Expect <img class="… portal-logo"> (or equivalent).
  4. Observe missing (or incorrect) portal-logo on <img>.

Context

Footnotes

  1. portal_logo template + HeaderLogoPlugin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions