Skip to content

bug: thumbnail not being properly sized when slotted inside item #22935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Yohandah opened this issue Feb 17, 2021 · 4 comments · Fixed by #27014
Closed

bug: thumbnail not being properly sized when slotted inside item #22935

Yohandah opened this issue Feb 17, 2021 · 4 comments · Fixed by #27014
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@Yohandah
Copy link

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
@ionitron-bot ionitron-bot bot added the triage label Feb 17, 2021
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Feb 17, 2021
@ionitron-bot ionitron-bot bot removed the triage label Feb 17, 2021
@liamdebeasi liamdebeasi changed the title bug: ion-thumbnail size attribute doesn't work in ion-item bug: thumbnail not being properly sized when slotted inside item Feb 17, 2021
@dotNetkow
Copy link
Contributor

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
Copy link
Contributor

dotNetkow commented Aug 12, 2021

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

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

@idesignpixels
Copy link

Still an issue in Ionic 6.19.0

@liamdebeasi liamdebeasi added type: bug a confirmed bug report and removed type: bug a confirmed bug report labels Mar 13, 2023
thetaPC added a commit that referenced this issue Mar 23, 2023
thetaPC added a commit that referenced this issue Mar 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
resolves #22935

---------

Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: liamdebeasi <liamdebeasi@users.noreply.github.com>
@ionitron-bot
Copy link

ionitron-bot bot commented Apr 23, 2023

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 ionitron-bot bot locked and limited conversation to collaborators Apr 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants