-
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
Change Audit Descriptions based on Audit Results #2478
Change Audit Descriptions based on Audit Results #2478
Conversation
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 again! using fallbackDescription
and audit logic looks a-ok to me
lighthouse-core/audits/viewport.js
Outdated
@@ -17,6 +17,8 @@ class Viewport extends Audit { | |||
category: 'Mobile Friendly', | |||
name: 'viewport', | |||
description: 'Has a `<meta name="viewport">` tag with `width` or `initial-scale`', | |||
fallbackDescription: 'Does not have a `<meta name="viewport">` tag with `width` ' + | |||
'or `initial-scale`', |
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.
nit: indentation
@@ -21,6 +21,8 @@ class VideoDescription extends AxeAudit { | |||
category: 'Accessibility', | |||
name: 'video-description', | |||
description: '`<video>` elements contain a `<track>` element with `[kind="description"]`.', | |||
fallbackDescription: '`<video>` elements do not contain a `<track>` element with ' + | |||
'`[kind="description"]`.', |
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.
nit: indentation
@@ -21,6 +21,8 @@ class VideoCaption extends AxeAudit { | |||
category: 'Accessibility', | |||
name: 'video-caption', | |||
description: '`<video>` elements contain a `<track>` element with `[kind="captions"]`.', | |||
fallbackDescription: '`<video>` elements do not contain a `<track>` element ' + | |||
'with `[kind="captions"]`.', |
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.
nit: indentation
@@ -22,6 +22,8 @@ class THHasDataCells extends AxeAudit { | |||
name: 'th-has-data-cells', | |||
description: '`<th>` elements and elements with `[role="columnheader"/"rowheader"]` have ' + | |||
'data cells they describe.', | |||
fallbackDescription: '`<th>` elements and elements with ' + | |||
'`[role="columnheader"/"rowheader"]` do not have data cells they describe.', |
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.
nit: indentation
@@ -23,6 +23,8 @@ class TDHeadersAttr extends AxeAudit { | |||
name: 'td-headers-attr', | |||
description: 'Cells in a `<table>` element that use the `[headers]` attribute only refer ' + | |||
'to other cells of that same table.', | |||
fallbackDescription: 'Cells in a `<table>` element that use the `[headers]` ' + | |||
'attribute refers to other cells of that same table.', |
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.
nit: indentation
@@ -21,6 +21,8 @@ class HTMLLangValid extends AxeAudit { | |||
category: 'Accessibility', | |||
name: 'html-lang-valid', | |||
description: '`<html>` element has a valid value for its `[lang]` attribute.', | |||
fallbackDescription: '`<html>` element does not have a valid value for ' + | |||
'its `[lang]` attribute.', |
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.
nit: indentation
'or <template> elements.', | ||
'or `<template>` elements.', | ||
fallbackDescription: '`<dl>`\'s do not contain only properly-ordered `<dt>` and `<dd>` ' + | ||
'groups, `<script>` ' + |
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.
nit: indentation, can collapse these two lines too
@@ -22,6 +22,8 @@ class ColorContrast extends AxeAudit { | |||
category: 'Accessibility', | |||
name: 'color-contrast', | |||
description: 'Background and foreground colors have a sufficient contrast ratio.', | |||
fallbackDescription: 'Background and foreground colors do not have a ' + | |||
'sufficient contrast ratio.', |
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.
nit: indentation
@@ -21,6 +21,8 @@ class AudioCaption extends AxeAudit { | |||
category: 'Accessibility', | |||
name: 'audio-caption', | |||
description: '`<audio>` elements contain a `<track>` element with `[kind="captions"]`.', | |||
fallbackDescription: '`<audio>` elements are missing a `<track>` element with ' + | |||
'`[kind="captions"]`.', |
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.
nit: indentation
description: '`[role]`s that require child `[role]`s contain them.', | ||
description: 'Elements with `[role]` that require specific children `[role]`s, are present.', | ||
fallbackDescription: 'Elements with `[role]` that require specific children `[role]`s, ' + | ||
'are missing.', |
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.
nit: indentation
|
unfortunately eslint's indent support is quite limited, one day we'll just say run prettier and problem solved but for now it's a human endeavor :/ |
All done now, tell me if you need an addition to the new feature on password pasting 👍 |
Here's the "docs journey" that I want to protect:
So, it seems that users will see the |
@@ -22,6 +22,8 @@ class List extends AxeAudit { | |||
name: 'list', | |||
description: 'Lists contain only `<li>` elements and script supporting elements ' + | |||
'(`<script>` and `<template>`).', | |||
fallbackDescription: 'Lists do not contain only `<li>` elements and script ' + | |||
'supporting elements (`<script>` and `<template>`).', |
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.
Side note: In this iteration I see that we're just inversing the description. But I think sometimes that leads to clunky sentences. We can make the fallbacks more readable by rephrasing them:
E.g. this one could be changed to Lists contain invalid elements
I'm not asking you to do this now, just noting 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.
Yeah that's what I did initially. We be a bit more expressive though?
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.
Right. I'd hate to lose the full description when someone fails. That's when they need the most help :) Most of the time, users will start off failing the audit. I think it will also be quite confusing if the two descriptions change a lot. People are going to be like "where did that audit go that I was just failing"?
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.
Need a suggestion if I'm to change this 👍
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.
No change needed (from me, at least). Just discussing
@ev1stensberg can you rebase? |
Done |
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.
bikeshed: rename property as failureDescription
? "fallback" isn't very specific
lighthouse-core/audits/audit.js
Outdated
|
||
let auditDescription = audit.meta.description; | ||
if (audit.meta.fallbackDescription) { | ||
if (!result.rawValue || (typeof result.rawValue === 'number' && result.rawValue < 100)) { |
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.
Maybe I missed this in the last PR review, but shouldn't this be based on score
?
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.
Yup, and DOM size is invalid cause of that, one of the things that needed discussion. I change the code accordingly to @patrickhulce 's last comment on the other branch
Evidently I really wanted to use the labels that are used, but that happens later
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.
Changed in new commit
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.
yeah we should really be doing that step much earlier than in report-generator.js
so things like this don't happen
lighthouse-core/audits/audit.js
Outdated
|
||
let auditDescription = audit.meta.description; | ||
if (audit.meta.fallbackDescription) { | ||
if (!result.rawValue || (typeof result.rawValue === 'number' && result.score < 100)) { |
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.
@ev1stensberg I believe brendan intended this entire expression to be based on score
the local variable since that already does the correct use of result.rawValue
if a score isn't set
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.
Pushed a new commit, is that what you meant? Sorry, was a bit unsure when I review a second time!
@brendankenny Done now, I agree! |
@ev1stensberg can you help us out with rebasing this? once that's done we can merge. |
🇲🇰 |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
fixes #2311, #1611, #2326, #1613
this PR was started in #2418 and then moved here.