Skip to content

Commit 6b77a8d

Browse files
authored
fix: responsive aspect ratios don't work with intermediate elements (#5402)
* Handle intermediate image container divs * Tweak responsive example * change aspect ratios
1 parent ce8551b commit 6b77a8d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vanilla-framework",
3-
"version": "4.18.0",
3+
"version": "4.18.1",
44
"author": {
55
"email": "webteam@canonical.com",
66
"name": "Canonical Webteam"

scss/_patterns_image.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ $aspect-ratios: (
8484
justify-content: center;
8585
text-align: center;
8686

87+
// If there is a child element that is not the image, don't let it affect the layout
88+
& > *:not(.p-image-container__image) {
89+
display: contents;
90+
}
91+
8792
&.is-highlighted {
8893
background: $colors--theme--background-alt;
8994
}

templates/docs/examples/patterns/image/container/aspect-ratio/responsive.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
{% block standalone_css %}patterns_image{% endblock %}
55

66
{% block content %}
7-
<div class="p-image-container--cinematic-on-large p-image-container--16-9-on-medium p-image-container--2-3-on-small is-highlighted">
8-
<img class="p-image-container__image"
9-
src="https://assets.ubuntu.com/v1/9b4c074f-Kernelt%20industries-80-short.png" width="300" alt="">
7+
<div class="p-image-container--square-on-small p-image-container--16-9-on-medium p-image-container--cinematic-on-large is-highlighted">
8+
<div class="lazyloaded">
9+
<img src="https://assets.ubuntu.com/v1/f74cb1d3-streaming%20data.png" alt="" width="852" height="1279" loading="lazy" class="p-image-container__image">
1010
</div>
11+
</div>
1112
{% endblock %}

0 commit comments

Comments
 (0)