scottish-government-design-system / design-system

Design System for the Scottish Government and other Scottish public sector bodies
https://designsystem.gov.scot
MIT License
26 stars 11 forks source link

[BUG] Images in Aspect Box are not sized correctly #113

Open lewisdorigo opened 1 month ago

lewisdorigo commented 1 month ago

Description of the issue

When an Aspect Box is used within a page layout, images are incorrectly sized.

This is because, in src/base/objects/layout/_layout.scss, image height is set to auto.

This selector's specificity means it is overriding the height specified in src/components/aspect-box/_aspect-box.scss.

Steps to reproduce the issue

<div class="ds_layout">
    <div class="ds_layout__content">
          <div class="ds_aspect-box  ds_aspect-box--square">
                <img
                     src="//picsum.photos/1280/720/"
                     alt=""
                     class="ds_aspect-box__inner"
                />
          </div>
    </div>
</div>

Expected behaviour

The image shows as a square, cropped to the centre of the image.

Screenshots

Screenshot 2024-08-08 at 12 47 24 PM

(Added outlines to aspect box, and to image to show bounding boxes).

jsutcliffe commented 1 month ago

Thanks Lewis. A fix for this is currently in testing and will be in the next release.