-
Notifications
You must be signed in to change notification settings - Fork 9.5k
report: add label to provide context for subItems #13858
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
1579340
56491ce
e406077
467ebd8
7d25e8f
e275708
f12f550
fea8745
8eb2316
0fcc356
59d5653
8730ae4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -16,11 +16,17 @@ const i18n = require('../../lib/i18n/i18n.js'); | |||||
const UIStrings = { | ||||||
/** Label of a table column that identifies HTML elements that have failed an audit. */ | ||||||
failingElementsHeader: 'Failing Elements', | ||||||
/** Label of a table column that identifies HTML elements that are related to a failure in an audit. */ | ||||||
relatedElementsHeader: 'Related Elements', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bump |
||||||
}; | ||||||
|
||||||
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings); | ||||||
|
||||||
class AxeAudit extends Audit { | ||||||
static get relatedNodesLabel() { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. static field or function instead of a getter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, this does match how we handle |
||||||
return str_(UIStrings.relatedElementsHeader); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Base class for audit rules which reflect assessment performed by the aXe accessibility library | ||||||
* See https://github.com/dequelabs/axe-core/blob/6b444546cff492a62a70a74a8fc3c62bd4729400/doc/API.md#results-object for result type and format details | ||||||
|
@@ -81,7 +87,10 @@ class AxeAudit extends Audit { | |||||
}, | ||||||
subItems: axeNode.relatedNodes.length ? { | ||||||
type: 'subitems', | ||||||
items: axeNode.relatedNodes.map(node => ({relatedNode: Audit.makeNodeItem(node)})), | ||||||
label: this.relatedNodesLabel, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. haha, this kind of thing makes me think axe-audit inheritance should just be killed and turned into a function call :) |
||||||
items: axeNode.relatedNodes.map(node => ({ | ||||||
relatedNode: Audit.makeNodeItem(node), | ||||||
})), | ||||||
} : undefined, | ||||||
})); | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,6 +23,8 @@ const UIStrings = { | |||||
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */ | ||||||
description: 'Low-contrast text is difficult or impossible for many users to read. ' + | ||||||
'[Learn more](https://web.dev/color-contrast/).', | ||||||
/** Label of a table column that identifies a single HTML element that is the background of another HTML element. */ | ||||||
backgroundElementHeader: 'Background Element', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}; | ||||||
|
||||||
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings); | ||||||
|
@@ -40,6 +42,10 @@ class ColorContrast extends AxeAudit { | |||||
requiredArtifacts: ['Accessibility'], | ||||||
}; | ||||||
} | ||||||
|
||||||
static get relatedNodesLabel() { | ||||||
return str_(UIStrings.backgroundElementHeader); | ||||||
} | ||||||
} | ||||||
|
||||||
module.exports = ColorContrast; | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -20,6 +20,8 @@ const UIStrings = { | |||||
failureTitle: 'ARIA IDs are not unique', | ||||||
/** Description of a Lighthouse audit that tells the user *why* they should try to pass. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */ | ||||||
description: 'The value of an ARIA ID must be unique to prevent other instances from being overlooked by assistive technologies. [Learn more](https://web.dev/duplicate-id-aria/).', | ||||||
/** Label of a table column that identifies HTML elements that are duplicates of another HTML element. */ | ||||||
relatedElementsHeader: 'Duplicate Elements', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}; | ||||||
|
||||||
const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings); | ||||||
|
@@ -37,6 +39,10 @@ class DuplicateIdAria extends AxeAudit { | |||||
requiredArtifacts: ['Accessibility'], | ||||||
}; | ||||||
} | ||||||
|
||||||
static get relatedNodesLabel() { | ||||||
return str_(UIStrings.relatedElementsHeader); | ||||||
} | ||||||
} | ||||||
|
||||||
module.exports = DuplicateIdAria; | ||||||
|
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.
singular/plural for this is somewhat unfortunate. "Reasons" (when there's only one reason) seems worse to me than e.g. "Duplicate Elements" for some reason.
Could maybe make it the count an argument and only do a single option for cases that are always singular? I don't know if TC or whatever will complain/get weird with
{relatedNodeCount, plural, other {Background Element}}
, though.