Skip to content

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented Apr 15, 2022

This adds a field label to TableSubItems, to help improve context when rendering subitems underneath a table item row.

Audit subitem label
axe-audit (base) Related Elements
color-contrast Background Element
duplicate-id-aria Duplicate Elements
duplicated-javascript Script
legacy-javascript Location
unused-javascript Module
csp-xss Reasons
inspector-issues URL
non-composited-animations Reasons
hreflang Reasons
third-party-facades Script

image

image

image


Did not give third-party-web a subitems label because it seems good already

image

cnn report here: https://lighthouse-1065v6gec-googlechrome.vercel.app/gh-pages/viewer/?gist=8fdec0793bab3abea4e66bc1129b06d7

@connorjclark connorjclark requested a review from a team as a code owner April 15, 2022 18:18
@connorjclark connorjclark requested review from adamraine and removed request for a team April 15, 2022 18:18
@connorjclark connorjclark changed the title report: add subItem label report: add label to provide context for subitems Apr 15, 2022
@connorjclark connorjclark changed the title report: add label to provide context for subitems report: add label to provide context for subItems Apr 15, 2022
@connorjclark
Copy link
Collaborator Author

hr too much?

light mode

image

@adamraine
Copy link
Member

hr too much?

IMO yes. Would underline work?

@connorjclark
Copy link
Collaborator Author

wb some width: max-content on the lh-text to limit the size to just under the text?

image

underline looks pretty weaksauce imo:

image

@adamraine
Copy link
Member

Yeah underline is weaksauce, bad idea. Even the shortened line looks a little weird.

I played around a bit, I think the full line would work better if it were gray instead of white/black:

Screen Shot 2022-04-15 at 3 59 11 PM

Copy link
Contributor

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall I like it better, but the audits with screenshots maybe need another iteration. The screenshot makes it harder to differentiate the levels and they also get busier with the extra label and hr

};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

class AxeAudit extends Audit {
static get relatedNodesLabel() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static field or function instead of a getter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this does match how we handle meta.

@@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The 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 :)

@@ -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',
Copy link
Contributor

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.

@@ -98,28 +98,33 @@ describe('LegacyJavaScript audit', () => {
]);
expect(result.items).toHaveLength(1);
expect(result.items[0]).toMatchInlineSnapshot(`
Object {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation issue with these files?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops. You have to babysit jest when asking it to -u inline snapshots. It was fixed for a short minute... but regressed at some point. Maybe fixed in latest, idk.

@paulirish
Copy link
Member

but the audits with screenshots maybe need another iteration.

yeah.. i tried out some styles to shrink the screenshot + constrain the text for subrows. it's.. better.

screenshot and whack-ass styles image
.lh-sub-item-row .lh-element-screenshot {
  zoom: 0.4
}

.lh-sub-item-row .lh-node {
  max-height: calc(100px * 0.4);
  overflow: hidden;
  display: block;

}

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these capitals feel extraneous. (though perhaps we adopted a style for this already?)

i don't have a great idea on the label's typography or graphical delineation...

@Jiwoong can you help us out?

  1. we're adding this label to communicate what these sub items are all about. it looks aiight but you could probably help us with it
  2. especially when theres more thumbnails in the sub items, the layout gets pretty wonky and hard to follow.. especially tricky cuz we autosize based on aspect ratio and the aspect ratios are totally unpredictable. in an above comment i tried shrinking subitem thumbnails. any ideas?

@@ -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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
relatedElementsHeader: 'Related Elements',
relatedElementsHeader: 'Related elements',

Copy link
Collaborator Author

@connorjclark connorjclark Apr 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but Failed Elements :( change that too? it's the (regular) column text

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump

@@ -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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
backgroundElementHeader: 'Background Element',
backgroundElementHeader: 'Background element',

@@ -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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
relatedElementsHeader: 'Duplicate Elements',
relatedElementsHeader: 'Duplicate elements',

@vercel
Copy link

vercel bot commented Dec 5, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
lighthouse ✅ Ready (Inspect) Visit Preview Dec 6, 2022 at 6:21PM (UTC)

@connorjclark
Copy link
Collaborator Author

made the line thinner (pictures have been updated)

@connorjclark
Copy link
Collaborator Author

we don't like how we show the sub-row label multiple times

let's add the label to be just below the main header label, but like this:

Failing Element
   | Duplicated Elements

and lets also add that vertical line to the sub row items (like already done for insight audit tables)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants