-
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(lhr): drop informative/manual, moving them to scoreDisplayMode #5105
Conversation
6eb070b
to
e2ac49c
Compare
throw new Error(`${auditRef.id} accessibility audit does not have a group`); | ||
} | ||
|
||
if (auditRef.weight > 0 && isManual) { |
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 went ahead and did it here @brendankenny since I was rebasing anyway
yah sgtm |
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.
had thought null scores were part of this, too, but realize it's not. all good.
auditEl.classList.add('lh-audit--informative'); | ||
} | ||
if (audit.result.manual) { | ||
if (audit.result.scoreDisplayMode === 'manual') { |
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.
else if
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 do this in a little loop
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.
lh-audit--${audit.result.scoreDisplayMode}
cool with you?
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.
lol yeah excellent.
travis sez run |
I think it makes sense, too. I could see a future where an audit doesn't have enough information and wants to mark itself informative, too. It makes sense for |
typings/audit.d.ts
Outdated
@@ -114,12 +115,9 @@ declare global { | |||
scoreDisplayMode: ScoringModeValue; | |||
description: string; | |||
extendedInfo?: {[p: string]: any}; | |||
notApplicable?: boolean; |
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.
not sure where the best place to put docstrings for audit authors to see, but maybe add a jsdoc string to notApplicable
in Product
to mention it would override scoreDisplayMode
if provided?
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 done
typings/audit.d.ts
Outdated
} | ||
|
||
export type ScoringModeValue = Audit.ScoringModes[keyof Audit.ScoringModes]; | ||
export type ScoringModeValue = Audit.ScoreDisplayModes[keyof Audit.ScoreDisplayModes]; |
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.
should this type be ScoreDisplayMode
now? Seems like it makes sense
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 sg
let {score, scoreDisplayMode} = Audit._normalizeAuditScore(audit, result); | ||
|
||
// If the audit was determined to not apply to the page, we'll reset it as informative only | ||
let informative = audit.meta.informative; | ||
if (result.notApplicable) { | ||
score = 1; |
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.
should we be enforcing the other things we say we do? Like no score if not binary or numeric display mode?
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're gonna do that in followup
@brendankenny LGTY? |
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.
whoops, yes, LGTM!
removes informative/manual/notApplicable booleans from
LH.Audit.Result
, usesscoreDisplayMode
for all of these nowkeeps
notApplicable
on theLH.Audit.Product
though whichcreateAuditResult
uses to set the scoreDisplayMode tonot-applicable
, it felt a little more natural to me as the runtime split, but curious what other folks think@paulirish FYI this probably has a few implications for your design changes i.e. an audit can no longer be both binary informative (made some blue 0s show up)
ref #5008 #4333