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

Aspect ratio audit fails on SVG #3716

Closed
peterjanes opened this issue Nov 1, 2017 · 7 comments
Closed

Aspect ratio audit fails on SVG #3716

peterjanes opened this issue Nov 1, 2017 · 7 comments

Comments

@peterjanes
Copy link

The image aspect ratio audit appears to fail for SVG images. If you run a "best practices" audit on the standalone HTML file in this zip (unzip it and put it on a webserver) you'll see it includes

Does not uses Images with appropriate aspect ratio
Image displayed sizes should match their natural aspect ratio.

I've tried it with different combinations of width/height attributes and CSS, and none can make it pass the audit.

@patrickhulce
Copy link
Collaborator

Thanks for reporting @peterjanes! We ignore SVGs for responsive image savings but we should ignore them here too 👍

For any potential first-time bug fixers, we just need to filter out based on mimeType here

// filter out images that don't have following properties
// networkRecord, width, height, images that use `object-fit`: `cover` or `contain`
return image.networkRecord &&
image.width &&
image.height &&
!image.usesObjectFit;

@TejasQ
Copy link

TejasQ commented Nov 2, 2017

On it! Is it just the image/svg+xml mimeType to filter out right now, or is there a list of mimeType we want to filter out?

@patrickhulce
Copy link
Collaborator

Thanks so much for volunteering @TejasQ but Peter beat you to the punch 😄 feel free to take a look at some of our other good first issues!

@TejasQ
Copy link

TejasQ commented Nov 2, 2017

Thanks @patrickhulce! Missed the reference from @peterjanes!

@leonardorey1970
Copy link

Hi all, do you have any idea about when this changes will deployed to prod?.

Cheers!
Leo

@patrickhulce
Copy link
Collaborator

@leonardorey1970 should go out with our next release by end of this week in extension and CLI. Chrome stable will get it around end of January.

@leonardorey1970
Copy link

Thanks patrickhulce for your reply!

christhompson pushed a commit to christhompson/lighthouse that referenced this issue Nov 28, 2017
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants