Skip to content
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

Image component with fit='contain' should constrain the height of the image inside the container #940

Open
jduff opened this issue May 16, 2023 · 5 comments
Labels
bug Something isn't working Checkout UI Components This issue is related to the Checkout UI component library

Comments

@jduff
Copy link

jduff commented May 16, 2023

Please list the package(s) involved in the issue, and include the version you are using

checkout-ui-extensions

Describe the bug

When using an image component with fit='contain' the image should be contained within the container.

Steps to reproduce the behavior:

  1. Set up an Image with fit contain inside an InlineLayout with fixed sizes. ex (using htm templates):
<InlineLayout spacing='extraTight' maxInlineSize=${20} maxBlockSize=${100} overflow='hidden'>
  <Image fit='contain' source="example.png" />
</InlineLayout>

Expected behavior

The image should be resized to the height of the container instead of overflowing out of it.

Screenshots

Screenshot 2023-05-16 at 3 49 53 PM

Additional context

Constraining the width works fine, I think this is because max-width: 100% is added to the image. Adding max-height: 100% when using fit='contain' should fix this issue.

I'm open to other solutions here, but no combination of InlineLayout / BlockLayout / View with various maxInlineSize or maxBlockSize have worked for me to constrain the height of the image. Another solution would be adding maxWidth and maxHeight properties to the Image component as well.

@jduff jduff added the bug Something isn't working label May 16, 2023
@ryan-ludwig ryan-ludwig added the Checkout UI Components This issue is related to the Checkout UI component library label May 16, 2023
@ryan-ludwig
Copy link
Contributor

Thanks for the report, @jduff . We're adding it to our backlog for prioritization.

@edhgoose
Copy link

edhgoose commented Jul 1, 2024

Hi @ryan-ludwig - do you have any update on this issue?

It appears that I have the same experience - maxInlineSize seems to work exactly as I'd expect, but like @jduff I find that no combination of maxBlockSize applies any change to the imagery.

When I apply maxInlineSize, I get CSS applied to the component which adjusts the behaviour as I'd expect. But, if I use maxBlockSize I can't see any CSS even applied that would influence the size.

@ryan-ludwig
Copy link
Contributor

Hey @edhgoose, thanks for the info. We've got it triaged but haven't started work on it yet.

@michael-visualsquares
Copy link

@ryan-ludwig Is there any updates on this? This would be really helpful in the new Customer Account Extensions that are coming out.

@aaronbhansen
Copy link

aaronbhansen commented Jan 14, 2025

I'm also still seeing this on 2025-01 release. No visual changes on maxBlockSize, only constrained on maxInlineSize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Checkout UI Components This issue is related to the Checkout UI component library
Projects
None yet
Development

No branches or pull requests

7 participants