Cannot set height without width or vice-versa

Created on 3 May 2023, about 1 year ago
Updated 13 October 2023, 9 months ago

Problem/Motivation

We are trying to place two SVG images inline in a banner, linked to different URLs. To get these lined up, while still allowing editors to update the links, we're embedding them in a WYSIWYG in a normal block, as a media entity with a special view mode. We want to constrain the height but not the width.

The current dimensions get set on the SVG element, making it a fixed aspect ratio for any image using this preset. In our case, omitting the dimensions made the images not render at all. Setting one but not the other works fine, but throws an error when the cache is rebuilt.

Steps to reproduce

Add an SVG field, set the formatter to inlined and a specific height and width, and upload SVGs of different aspect ratios. All of them end up with the same dimensions set.

Rebuild the cache and see error messages (in logs if errors are set to not show on screen).

Proposed resolution

Allow either height or width to be left blank.

Remaining tasks

Write patch.

๐Ÿ› Bug report
Status

Fixed

Version

2.3

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States freelock Seattle

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024