Image SDC: Image component renders empty attributes when values are not set

Created on 30 July 2025, 2 days ago

Problem/Motivation

The Radix themeโ€™s image component currently outputs empty attributes on the <img> tag when these values are not provided. This results in HTML such as:
<img data-component-id="radix:image" class="page" src="/themes/custom/radix-3537368/logo.svg" alt="" title="" width="" height="" loading="auto">

This issue is to clean up the markup, ensuring attributes are only rendered when they hold valid values.

Steps to reproduce

1) Implement the component:
Use the Radix image component in your Twig template without specifying attributes. For example:

{% include 'radix:image' with {
  src: '/themes/contrib/radix/logo.svg',
} %}

2) Review output:
Inspect the rendered HTML in the browser via the developer tools.

3) Observe the issue:
Notice that the <img> tag includes empty alt, title, width and height attributes:
<img data-component-id="radix:image" class="page" src="/themes/custom/radix-3537368/logo.svg" alt="" title="" width="" height="" loading="auto">

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Active

Version

6.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia anirudhsingh19

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024