ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: thumbnail not being properly sized when slotted inside item

Open Yohandah opened this issue 3 years ago • 3 comments

Bug Report

Ionic version: [x] 5.x

Current behavior:

The ionic docs says :

Thumbnails can be used by themselves or inside of any element. If placed inside of an ion-item, the thumbnail will resize to fit the parent component

But when a ion-thumbnail is inside a ion-item and slotted, it doesn't fit the ion-item, instead it forces its size to 56px which makes the ion-item height 56px.

image

If we want to make the thumbnail smaller we can use the --size attribute, but it is overridden by the code above when slotted.

I add the size attribute : image

The ion-thumbnail size attribute is overridden by the slotted css :

image

Expected behavior:

The size attribute shouldn't be overridden ? Why force the height/width to 56px when slotted ?

Steps to reproduce:

Go to : https://ionicframework.com/docs/api/thumbnail

  • With your browser, inspect a thumbnail in the example in the top right corner
  • Set a --size attribute to a value, for example 20px
  • The thumbnail doesn't change its size

Yohandah avatar Feb 17 '21 13:02 Yohandah

To expand on this with a code example for reproduction, I also tried ion-item's min-height property to make the parent (ion item) larger. It didn't work though.

ion-item {
  --min-height: 200px; // or any large size
}

ion-thumbnail {
  --size: 108px;  // this should take effect but doesn't
  --border-radius: 12px;
}
<ion-item>
  <ion-thumbnail slot="start">
     <img src="path"/>
   </ion-thumbnail>
</ion-item>

dotNetkow avatar Aug 11 '21 18:08 dotNetkow

As a workaround, I directly set the height and width of the ion-thumbnail:

.thumbnail {
  height: 108px;
  width: 108px;
}

dotNetkow avatar Aug 12 '21 20:08 dotNetkow

Still an issue in Ionic 6.19.0

idesignpixels avatar Jul 12 '22 13:07 idesignpixels

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Apr 23 '23 18:04 ionitron-bot[bot]