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

When setting a default of ignoreUrl: true, the pa11y() function shouldn't require a url parameter #535

Open
wesrice opened this issue Oct 29, 2020 · 1 comment

Comments

@wesrice
Copy link

wesrice commented Oct 29, 2020

Expected behaviour

  1. options.page exists, but there is no default pa11y.default.page is not defined. This is not a huge deal, it's just a little confusing, as pa11y.default.browser is defined as null.

  2. When setting my own pa11y.defaults.page, I expected to be able to set pa11y.defaults.ignoreUrl and not have to provide the url parameter or options.url.

Additionally, if pa11y.defaults.url is set, then there is no need for any parameters to be passed to pa11y().

Actual behaviour

pa11y() expects a url, either as a param or via options. The code that handles this does not consider if ignoreUrl is in use. https://github.com/pa11y/pa11y/blob/master/lib/pa11y.js#L71

This results in me having to do the following if I pass in my own page object.

// `browser` and `page` defined elsewhere
pa11y.defaults = {
  ...pa11y.defaults,
  browser,
  page,
  ignoreUrl: true,
};
await pa11y('');

The empty string passed in await pa11y(''); seems like a really minor deal, but the setup and configuration of pa11y is separate from its usage in my code. I'm afraid it results in being confusing for others who might not understand why they need to use pa11y('') instead of pa11y().

Steps to reproduce

// `browser` and `page` defined elsewhere

pa11y.defaults = {
  ...pa11y.defaults,
  browser,
  page,
  ignoreUrl: true,
};
await pa11y();

Environment:

Pa11y:      5.3.0
Node.js:    12.18.2
npm:        6.14.8
OS:         19.6.0 (darwin)
@wesrice
Copy link
Author

wesrice commented Oct 29, 2020

I have a PR forthcoming to address this.

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

Successfully merging a pull request may close this issue.

2 participants