axe-core icon indicating copy to clipboard operation
axe-core copied to clipboard

Which rules are supported by JSDOM?

Open myasonik opened this issue 2 years ago • 2 comments

Product

axe-core

Description

In the jest_react example, color-contrast and link-in-text-block are disabled because the readme states that they're not supported in JSDOM.

The main readme however only calls out the color-contrast rule not working. (Not owned by Deque, but maybe worth noting, this is also corroborated by jest-axe which also says only color-contrast doesn't work.)

Just wondering if it's known which documentation is most up to date? Might also be worth documenting exactly why they're not supported in JSDOM (i.e., what specific APIs are missing)

myasonik avatar May 12 '23 17:05 myasonik

Agreed. We should update the readme. Looking over the list of rules, I think there are quite a few rules that won't be all that useful in JSDOM:

  • avoid-inline-spacing
  • color-contrast
  • color-contrast-enhanced
  • css-orientation-lock
  • focus-order-semantics
  • frame-focusable-content
  • frame-tested
  • link-in-text-block
  • scrollable-region-focusable
  • target-size

There's no harm in running these. It's just not going to give useful results, so you might as well turn them off. I don't know that I'd want to put this all into the readme. Perhaps we should have "jsdom-skip" tag to provide a consistent way of documenting these and of turning them off as well.

WilcoFiers avatar May 15 '23 10:05 WilcoFiers

For anyone else potentially coming across this, two more caveats that aren't clearly laid out anywhere:

  • JSDOM doesn't pull in external resources by default (namely, CSS files) though this can be changed in configuration options
  • JSDOM has no support for media queries

So if you're relying on CSS to be present to make something accessible, you can run into further difficulties with JSDOM.

myasonik avatar Oct 17 '23 20:10 myasonik