Skip to content

Improve node selectors shown in the details table #4015

@kdzwinel

Description

@kdzwinel

In is-crawlable and hreflang audits nodes listed in the details table have no selector set eg.

source: {
  type: 'node',
  snippet: `<meta name="robots" content="${artifacts.MetaRobots}" />`,
 //selector: ??
},

This causes resulting table item title to be set to 'undefined':

undefined-title

We should show element selector instead, just like axe-core audits do:

axe-title

However, to build a full selector we'd need class+id+nodeName for given node and all its ancestors which would require more work from the gatherers.

font-size audit is in a bit better situation because we do have all the data needed from the gatherer, however, we still can't reuse getSelector from axe-core since we don't have real DOM nodes, but rather devtools protocol nodes.
I've put together a simpler alternative that would work here, but it doesn't guarantee selectors to be pretty or unique. For now we decided to show only id, class or node name of the parent element.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions