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

Respect CropArea while generating placeholder image #75

Open
brosua opened this issue Feb 18, 2021 · 3 comments
Open

Respect CropArea while generating placeholder image #75

brosua opened this issue Feb 18, 2021 · 3 comments
Labels

Comments

@brosua
Copy link

brosua commented Feb 18, 2021

Images can be cropped to fit a certain aspect ratio. To display a placeholder image with a correct aspect ratio, the crop area should be used. Currently the original size is used. This helps to improve Cumulative Layout Shift.

@s2b
Copy link
Collaborator

s2b commented Feb 19, 2021

Could you give a concrete example where this is the case? Do you use srcset/sizes or picture?

@brosua
Copy link
Author

brosua commented Feb 22, 2021

I use picture.

@brosua brosua removed their assignment Feb 22, 2021
@s2b
Copy link
Collaborator

s2b commented Mar 7, 2021

Hm, I don‘t think that there can be a correct crop area to use for the placeholder image when using picture, at least not with my current implementation.

Currently I use the src attribute of the fallback image tag to provide that placeholder image. Thus, I can only set one placeholder and not one for each configured breakpoint. In order to do that, the implementation would need to add srcset attributes to the source tags and generate several placeholders.

However, I‘m not really sure if that would solve the original problem. The layout shift would probably occur either way because of #78. I guess that some layout shifting is just something we need to live with for now when using image art direction, until the HTML5 standard changes and browsers implement this.

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

No branches or pull requests

2 participants