salesforce / sa11y

Salesforce Automated Accessibility Testing Libraries
https://www.npmjs.com/org/sa11y
BSD 3-Clause "New" or "Revised" License
90 stars 22 forks source link

Unpin axe-core for compatibility with new versions #586

Open nwalters512 opened 11 months ago

nwalters512 commented 11 months ago

I recently updated axe-core to 4.8.2 in a project, but because the @sa11y/common package pins axe-core to 4.7.0, I end up with two distinct copies of axe-core in my project which don't have compatible types (see https://github.com/dequelabs/axe-core/pull/4081). This causes TypeScript to complain:

    Type 'import("/home/runner/work/PrairieLearn/PrairieLearn/node_modules/axe-core/axe").Result' is not assignable to type 'import("/home/runner/work/PrairieLearn/PrairieLearn/node_modules/@sa11y/common/node_modules/axe-core/axe").Result'.
      Types of property 'nodes' are incompatible.
        Type 'import("/home/runner/work/PrairieLearn/PrairieLearn/node_modules/axe-core/axe").NodeResult[]' is not assignable to type 'import("/home/runner/work/PrairieLearn/PrairieLearn/node_modules/@sa11y/common/node_modules/axe-core/axe").NodeResult[]'.
          Type 'import("/home/runner/work/PrairieLearn/PrairieLearn/node_modules/axe-core/axe").NodeResult' is not assignable to type 'import("/home/runner/work/PrairieLearn/PrairieLearn/node_modules/@sa11y/common/node_modules/axe-core/axe").NodeResult'.
            Types of property 'target' are incompatible.
              Type 'UnlabelledFrameSelector' is not assignable to type 'string[]'.
                Type 'CrossTreeSelector' is not assignable to type 'string'.
                  Type 'ShadowDomSelector' is not assignable to type 'string'.

This library should almost definitely unpin axe-core to allow new minor versions to be used without @sa11y/common needing to explicitly change.

I'd be happy to make this change if a maintainer could confirm that it will be accepted. It's not clear to me why the @sa11y/* packages pin dependencies in the first place.

nwalters512 commented 5 months ago

@navateja-alagam @jaig-0911 can y'all take a look at this? I'm currently stuck in a situation where I cannot upgrade axe-core because @sa11y/format has pinned it at an older version. This is very uncommon in the JS package ecosystem, so unless there's a good reason it's pinned to an old version, I'd love to open a PR unpinning axe-core.