axe-core
axe-core copied to clipboard
Question about object-alt issue when used with NodeJs & JSDOM
Product
axe-core
Question
I'm using axe-core with NodeJS and JSDOM (see this issue for more background) and noticed an issue when running object-alt. I get the error TypeError: range.getClientRects is not a function - feature unsupported in your environment. Skipping object-alt rule. I assume this is from my environment being a virtual DOM.
I looked up where this was happening and found object-is-loaded-matches.js which was added in Oct 2022 and seems to only be used for object-alt. There seems to be a param documented for a virtual node (currently line 10) but I don't see one being provided or used. Is there some way this could be fixed to allow me to run this rule on a virtual DOM like JSDOM, or am I not doing something I need to on my end to run this correctly?
Recreated with the example violative code found at https://dequeuniversity.com/rules/axe/4.7/object-alt.
Thanks in advance for any context or help you can provide!
That's an interesting question. The reason we added the matcher was to ensure we don't run the rule on objects that don't have content that is loaded. Since there wasn't a way to test for that we had to rely on a small hack to check (that is, testing the text content to see if there's no text).
I'll have to ask @WilcoFiers to see if running the rule on JSDOM environments make sense if we can't test for loaded content.
I think it makes sense to just work around this. If we're in a JSDOM env, assume the object will load and then run the rule. We should probably also figure out how we can better anticipate problems like that. We have a test suite that runs all rules. Perhaps we need to run a similar thing in JSDOM?