Skip to content
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

Support gatherer options, exclude css selectors in axe #10247

Open
stepet80 opened this issue Jan 22, 2020 · 4 comments
Open

Support gatherer options, exclude css selectors in axe #10247

stepet80 opened this issue Jan 22, 2020 · 4 comments

Comments

@stepet80
Copy link

stepet80 commented Jan 22, 2020

How can we exclude certain elements from the lighthouse cli run. In axe we can do the following where certain elements are excluded based on css selectors:

axe.run(
{
    exclude: [['.exclude1'], ['.exclude2']]
},
(err, results) => {
    // ...
});
@patrickhulce patrickhulce changed the title exclude css selectors with Lighthouse CLI Jan 22, 2020
@patrickhulce
Copy link
Collaborator

Thanks for filing! This isn't currently possible out of the box. You'd need to manually create a custom config and a copy of the accessibility gatherer to run axe with custom arguments yourself. #2087 is one step into making this more a reality with the ability to pass gatherer options, but we're a ways off from that at the moment.

@mohanraj-r
Copy link

mohanraj-r commented Feb 28, 2020

@patrickhulce Would this be specific to the Accessibility gatherer ? I have more knowledge of that and might be able to work on adding support for passing in the axe config to the gatherer. It could be part of the lighthouse/configuration as a separate GathererConfig section

module.exports = {
  extends: 'lighthouse:default',
  settings: {
    gathererConfig: {
         Accessibility: {
               // axe config overrides
         },
    },
  },
};

But I could also see this being extended to other Gatherers - which would be nice to have I guess. But I have no knowledge of other Gatherers and won't be able to contribute towards that. Maybe that can be a separate effort (by someone else) after adding config override ability to the Accessibility Gatherer?

@patrickhulce
Copy link
Collaborator

Thanks for the offer @mohanraj-r! We would want to make gatherer options be available to all gatherers but don't need to necessarily update any other gatherer to take advantage of them yet. We've implemented the early steps to make this happen before but they never landed.

Essentially we want to be able to define options alongside a gatherer, like can be done with audit options today. It would look something like the below

module.exports = {
  extends: 'lighthouse:default',
  passes: [
    {
      passName: 'defaultPass', 
      gatherers: [{id: 'custom-axe', path: 'Accessibility', options: {/* ... */}}],
    }
  ],
  audits: [
    {id: 'custom-axe-audit', path: 'path/to/custom/audit.js'}
  ]
}
@EmmanuelDemey
Copy link

Hi,

I double check this morning, I found this options property in the Gatherer configuration.

But I do not know how to get this options inside my Gatherer Implementation.

@patrickhulce how do you retrieve this options inside your custom-axe gatherer ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants