-
Notifications
You must be signed in to change notification settings - Fork 977
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
do not use raw url in srcset #3448
base: main
Are you sure you want to change the base?
Conversation
|
great point! thank you so much for your suggestion |
@JLarky thanks for making the changes! unfortunately it looks like a few of our integration tests are now getting errors specifically around the expected image width. It's inconsistent: looks like only client-side rendered tests are failing, not SSR'd content. Feel free to dig into it and try to get to the bottom of the issue. If not, we will need to find the time to investigate your PR further as soon as we have the bandwidth. |
Description
Sorry for the fly by PR :) I think I'm probably brigning this up more like a discussion than a proper PR. I've beein looking into image performance issues with builder content and the thing that I noticed is that you are putting raw url in the
srcset
without adding1x
or1w
attributes. Those images are showing up in theProperly size images Potential savings of xxx KiB
report of lighthouse (especially on the desktop). I think the proper solution according to all the standards and docs is to use intrinsic size of the image, so let's say I have an image of 1234px then proper srcset would be... 100w ... 200w ... 400w ... 800w ... 1200w ... 1234w
(drops 1600 and 2000), but that information is not awailable in the current Image props, so I'm proposing... 100w ... 200w ... 400w ... 800w ... 1200w ... 1600w ... 2000w ... 9999w
which I think is the best you can do in the current circumstances. The main point is that browser will basically ignroe the src set that doesn't have that last...w
directive, and the result is that you are sending tons of html with all those srcsets just for browser to ignore it :)