-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(aspect-ratio): skip aspect ratio audit for svg #3722
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
I've added my GitHub email to my Google account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for picking this up so quickly @peterjanes! 🎉 👏
@@ -32,7 +32,7 @@ describe('Images: aspect-ratio audit', () => { | |||
generateImage( | |||
{width: data.clientSize[0], height: data.clientSize[1]}, | |||
{naturalWidth: data.naturalSize[0], naturalHeight: data.naturalSize[1]}, | |||
generateRecord(), | |||
generateRecord({mimeType: data.mimeType}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's expecting two parameters so I believe this should look like generateRecord(undefined, data.mimeType)
then again, it doesn't really look like generateRecord
is very useful for this test at all and was copied from another file so you can probably just ditch the function entirely and pass in the object directly to generateImage
@@ -73,6 +73,7 @@ class ImageAspectRatio extends Audit { | |||
// filter out images that don't have following properties | |||
// networkRecord, width, height, images that use `object-fit`: `cover` or `contain` | |||
return image.networkRecord && | |||
image.networkRecord.mimeType !== 'image/svg+xml' && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to update the comment real quick to explain svg's don't have valid natural dimensions :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woohoo great work @peterjanes!
🎩 s off for both finding and fixing! 👏 🍰
huge! thanks so much @peterjanes 😁 |
* core(aspect-ratio): skip aspect ratio audit for svg, fixes GoogleChrome#3716 * core(aspect-ratio): use the correct svg mimeType in the test * core(aspect-ratio): skip aspect ratio audit for svg * core(aspect-ratio): use the correct svg mimeType in the test * core(aspect-ratio): explain why svg is filtered * core(aspect-ratio): better unit test (fails when it should)
Does it fix inline SVG images? |
@piotr-cz this PR won't show up in Chrome until M65 unfortunately But inline SVG images shouldn't be showing up currently at all since they don't have a network record. Do you have a reproducible case of this happening? |
No, I don't but it should be easy to reproduce with just any inline SVG image |
@piotr-cz it shouldn't be possible, and I'm not able to reproduce with any inline SVG image. That's why I'm asking if you remember where you saw it :) |
@patrickhulce The app I'm working on is quite complex and it would pretty hard to create test case out of it. It's not public, but I can send you a link by email to investigate if that's ok. |
sure that'd be great, email should be available on my GitHub profile |
@patrickhulce I've just send the link to email at Your GitHub profile. Would be helpful, if Lighthouse would add more info, for example which image doesn't pass the test. |
I'm pretty confident that the code matches the suggestion in #3716. I made an attempt at a new test, but it isn't correct (passes with and without the new check); suggestions welcome.