-
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(image-elements): make naturalWidth/Height property optional #11703
Conversation
@@ -196,7 +196,8 @@ describe('Page uses responsive images', () => { | |||
}); | |||
|
|||
assert.equal(auditResult.items.length, 0); | |||
assert.equal(auditResult.warnings.length, 1); | |||
// Images with non valid naturalWidth or naturalHeight are ignored. | |||
assert.equal(auditResult.warnings.length, 0); |
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.
Since we intend to skip the images with invalid width/height, would we still need the warnings
property of the uses-responsive-images.js
audit? Is it reasonable to remove it?
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.
or include the invalid images to the warnings
object? 👀
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.
If the warning ever triggers it would be a bug, so I would be in favor of removing the warning but still capturing in sentry.
image-aspect-ratio
has a similar warning.
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.
I'm not sure there's ever been complete alignment on what we should warn vs. skip going back several years, but I'm also +1 to removing the warnings here :)
I'm of the mindset that the warning information in cases like these is not actionable and of little value to the user, so given the current prominence we provide warnings I am against keeping them as warnings.
I see the value in something that lets a developer know that something weird happened during Lighthouse run (like the errors/warnings sidebar design) but until that day comes, I think it's mostly just noise and should be avoided unless there's actually an action for the developer to take (like the crossorigin warnings we have).
lighthouse-core/audits/byte-efficiency/uses-optimized-images.js
Outdated
Show resolved
Hide resolved
@@ -196,7 +196,8 @@ describe('Page uses responsive images', () => { | |||
}); | |||
|
|||
assert.equal(auditResult.items.length, 0); | |||
assert.equal(auditResult.warnings.length, 1); | |||
// Images with non valid naturalWidth or naturalHeight are ignored. | |||
assert.equal(auditResult.warnings.length, 0); |
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.
If the warning ever triggers it would be a bug, so I would be in favor of removing the warning but still capturing in sentry.
image-aspect-ratio
has a similar warning.
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.
Overall LGTM
lighthouse-core/audits/byte-efficiency/uses-optimized-images.js
Outdated
Show resolved
Hide resolved
lighthouse-core/audits/byte-efficiency/uses-responsive-images.js
Outdated
Show resolved
Hide resolved
lighthouse-core/audits/byte-efficiency/uses-responsive-images.js
Outdated
Show resolved
Hide resolved
lighthouse-core/audits/byte-efficiency/uses-optimized-images.js
Outdated
Show resolved
Hide resolved
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.
LGTM pt2
Second checkbox of #11642
Makes naturalWidth/Height property optional. Allows for these properties to be set only when sure.