Passing attributes to the <picture> tag in responsive_image elements is template-dependent, and does not work in stable9 and child themes

Created on 18 June 2024, 6 months ago

Problem/Motivation

Passing attributes to the <picture> tag in the responsive_image element only works if the theme or other template-altering code specifically allows for it.

Steps to reproduce

Do not include the name of an attribute, e.g. "data-my-attribute" in the setting "<img> tag attributes."

Pass that attribute to Media Helper when rendering a responsive image. Use a stable9-based theme, and do not install modules such as Picture Everywhere β†’ that override the responsive-image.html.twig template.

Because the default responsive_image template does not output {{ attributes }}, the attributes intended for the <picture> tag will not appear anywhere.

Proposed resolution

Considering adding an optional template override. Similar to Picture Everywhere, but requiring a toggle.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bvoynick

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

Comments & Activities

Production build 0.71.5 2024