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

chore: add axe-config-generator package #6395

Merged
merged 3 commits into from
Feb 13, 2023
Merged

Conversation

sfoslund
Copy link
Member

@sfoslund sfoslund commented Feb 1, 2023

Details

Add a axe-config-generator package, which generates an axe-config.json file containing the current ScanOptions we provide to axe.run for fastpass scans.

Motivation

Keep tool in centralized location

Context

We have been noticing confusion from users about how/ why the set of rules that the web extension uses differs from the set of rules that axe-core provides. This tool is the first step in increasing clarity about which rules the extension is running.

Pull request checklist

  • [n/a] Addresses an existing issue: #0000
  • Ran yarn fastpass
  • [n/a] Added/updated relevant unit test(s) (and ran yarn test)
  • [n/a] Verified code coverage for the changes made. Check coverage report at: <rootDir>/test-results/unit/coverage
  • PR title AND final merge commit title both start with a semantic tag (fix:, chore:, feat(feature-name):, refactor:). See CONTRIBUTING.md.
  • [n/a] (UI changes only) Added screenshots/GIFs to description above
  • [n/a] (UI changes only) Verified usability with NVDA/JAWS

@sfoslund sfoslund requested a review from a team as a code owner February 1, 2023 21:08
Copy link
Contributor

@dbjorge dbjorge left a comment

Choose a reason for hiding this comment

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

I think it would make more sense to set up the name/contents of the package according to a user's perspective. From a user's perspective, this package is just a wrapper around the config file, and the index.js bundle that builds the config file is an implementation detail of how this package is built, not something they would ever want to run themselves. I'd recommend:

  • Remove "generator" from the package name
    • We should consider using namespacing rather than a hyphenated prefix, it's more consistent with how most monorepos are laid out; eg, @accessibility-insights/axe-config
  • Make a new index that just exists to export the contents of the JSON file as a const variable, since that's how most users will want to use it in practice
  • Ensure that only that thin index file and the JSON file end up in drop/
  • Treat the current index file as a build step, rename it accordingly, ensure it doesn't end up in drop/

package.json Outdated Show resolved Hide resolved
Copy link
Contributor

@dbjorge dbjorge left a comment

Choose a reason for hiding this comment

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

Thanks, this looks great! Approved with 1 nit

@sfoslund sfoslund merged commit 0c6a9e4 into microsoft:main Feb 13, 2023
@sfoslund sfoslund deleted the AxeConfig branch February 13, 2023 17:17
dbjorge added a commit to microsoft/accessibility-insights-service that referenced this pull request Feb 22, 2023
…pty-table-header rule) (#2402)

#### Details

Today, Service decides which axe-core rules to use via a `RuleExclusion`
mechanism that starts from axe-core's default ruleset an disables rules
we don't use in web.

This is inconsistent with how accessibility-insights-web defines its
ruleset (via a combination of [axe-core's rule tags and explicit
overrides](https://github.com/microsoft/accessibility-insights-web/blob/[email protected]/src/scanner/get-rule-inclusions.ts)).
The difference in mechanisms led to a mistake during the axe-core 4.6.3
update where the rulesets became inconsistent between web and service.

To ensure consistency between web and service, this PR replaces
`rule-exclusion.ts` with a new mechanism based on the recently-added
`@accessibility-insights/axe-config` package in the web repo. That
package builds an axe config blob based on web's
`get-rule-inclusions.ts` mechanism. This update bundles a copy of the
current output of that package into `axe-configuration.ts` to form the
basis of service's axe configuration, and removes `rule-exclusion.ts`
entirely as obsolete.

Besides keeping the rules in sync, this also means adds a new axe-core
config option that was previously overridden by web but not service
(`"pingWaitTime": 1000` instead of the default 500ms). I decided to keep
the new value from the web config for consistency with web and because
both values are still very comfortably within the margin of error set by
the page level timeouts used in `page-timeout-config.ts`, even assuming
pages with multiple levels of iframe nesting.

##### Motivation

* Make it more reliable to keep web and service rules in sync.
* Disables the unintentionally-enabled `empty-table-header`
best-practice rule

##### Context

* Builds on @sfoslund 's work in
microsoft/accessibility-insights-web#6395
* Partially implements (but doesn't complete) #571
* I considered doing a fuller implementation that would involve creating
a publishing pipeline for the axe-config package, but I didn't want to
tie up the fix for the rule inconsistency in service vs web with that
process. This is still an incremental improvement that moves us closer
to that end state without the NPM package layer.
* Incorporates changes from
microsoft/accessibility-insights-web#6448 and
microsoft/accessibility-insights-web#6449

##### Testing

Besides the PR checklist, I validated that a local build of the scan
package against test site
https://www.catalog.update.microsoft.com/Home.aspx produced a report
consistent with [email protected]'s results (no violations), where previously
the service reported a slightly distinct set of errors (one violation of
the `empty-table-header` rule, which was accidentally omitted from
`rule-exclusions.ts` during the 4.6.3 update).

#### Pull request checklist
<!-- If a checklist item is not applicable to this change, write "n/a"
in the checkbox -->

- [x] Addresses an existing issue: Partially addresses #571
- [x] Added relevant unit test for your changes. (`yarn test`)
- [x] Verified code coverage for the changes made. Check coverage report
at: `<rootDir>/test-results/unit/coverage`
- [x] Ran precheckin (`yarn precheckin`)
- [ ] Validated in an Azure resource group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants