Image SCD: image_attributes inheriting attributes from its parent SDC/entity

Created on 8 July 2025, 23 days ago

Problem/Motivation

When the parent entities attributes array is passed to an SDC using radix:image - for example radix:card - the image SDC will get those attributes too.

Steps to reproduce

1) Use the card SDC in the node.html.twig and pass the nodes attributes to it:

    {% embed 'radix:card' with {
      card_attributes: attributes,
      card_title_suffix: title_suffix,
      card_image_src: image_file_url ? image_file_url : '',
      card_image_alt: image_alt ? image_alt : '',
      card_link_url: url,
      card_link_text: 'read more'|t,
      card_title: label,
      title_link: url,
    } %}

2) Check the resulting HTML:

     <!-- Component start: radix:card  -->
    <div class="contextual-region card card--tile border-0" data-component-id="radix:card">
      <!-- Component start: radix:image -->
      <img class="contextual-region card card--tile border-0 img-fluid card-img" data-component-id="radix:image" src="/sites/default/files/styles/card_lg/public/media/image/2025-05/todo_tt.webp?h=d1cb525d&amp;itok=NAkrWEpO" alt="" title="" width="" height="" loading="auto">
    </div>

Proposed resolution

Don't use attributes as default for the image SDC?

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

6.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024