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 improvments #538

Open
samiresua opened this issue Apr 2, 2024 · 4 comments
Open

Image component improvments #538

samiresua opened this issue Apr 2, 2024 · 4 comments

Comments

@samiresua
Copy link

samiresua commented Apr 2, 2024

I'm noticing some layout shift with images loading (using the ootb image component)

  • Are there plans to add width/ height attributes to the element to prevent this?
  • Are there also plans to include a loading="lazy" option for the image component too?
  • Are there plans to be able to swap out the src at different breakpoints?
@samiresua
Copy link
Author

Also, i wonder if auto be a more sensible default height for images (currently appears to be 100%) ?

This would avoid this sort of image stretching to occur over columns?

image

@elylucas
Copy link
Member

You can currently set the height and width of the image from the design section, which will stop the layout shifts from happening.

We are currently working on adding the loading attribute to the image component, expect that soon.

For the height auto/100% question, I wasn't able to reproduce the stretching you have in your screenshot. Could you share how you got that with having the height of the image set to 100%?

@sami616
Copy link

sami616 commented Apr 11, 2024

Hi there, this is a column component, rich text on the right, with image in the left. If the right hand columns height exceeds the left the stretching occurs - setting the image height to auto resolves this.

@sami616
Copy link

sami616 commented Apr 11, 2024

With regards to the layout shift, sometimes you want a fluid responsive image (ie - width: 100%) with the width and height attributes still set on the element. This should remove layout shift for responsive images too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants