SOLVED: Missing `'selector'` key in Image aspect ratio controls

In \Bricks\Element_Image::set_controls(), on line 142, $this->controls['_aspectRatio']['css'] is set without the selector key.

I’m not sure if this is a bug, as the image element doesn’t seem to be affected by this in practice. However I made a ‘Featured Image’ custom element using the same code. It has the ‘Link to Post’ control from the Post Title element. When the image is linked to the post, the aspect ratio property gets added to the CSS for the wrapping <a> element, not the <img>. This can cause the aspect ratio not to work in certain contexts, like in a flex layout.

Hi @squarestar and welcome to the forum. :partying_face:.

Yep, you are right. The selector is missing, so the aspect ratio is applied directly on the top level element.
So we either have to add the selector back or remove it, but as it stands now, it is not used.

I’ve created an internal task for this.

Thank you,
Matej

1 Like

We fixed this issue in Bricks 2.1 beta, now available as a manual download in your account (see changelog).

Please let us know if you are still experiencing issues.

As with any pre-stable release, please do not use it on a production website. It is intended for testing in a local or staging environment only.