Problem/Motivation
This was tested in Chrome on Linux. If any selector is put in for the shadow host/shadow root scanning feature. the JS crashes:
editoria11y.min.js?ryvlcc:730 Uncaught TypeError: Cannot read properties of null (reading 'querySelectorAll')
at editoria11y.min.js?ryvlcc:730:19671
at Array.forEach (<anonymous>)
at Ed11y.Ed11y.findElements (editoria11y.min.js?ryvlcc:730:19593)
at Ed11y.Ed11y.buildElementList (editoria11y.min.js?ryvlcc:730:19833)
at Ed11y.Ed11y.checkAll (editoria11y.min.js?ryvlcc:730:13376)
at e (editoria11y.min.js?ryvlcc:730:12537)
looking into the debug this line:
e.matches(Ed11y.options.shadowComponents) && (i[t] = e.shadowRoot.querySelectorAll(`:is(${n})` + s))
is the issue. e.shadowRoot is null. I was attempting to use this to scan inside of hidden accordion panels using a class selector, which the scanner currently seems to skip.
Steps to reproduce
1. add a selector into "Scan inside these Web components"
2. clear site cache
3. load a piece of content
4. scanner button does not appear
Comments
Comment #2
r_h-l commentedI did also try some other selectors, including base tags and none worked.
Comment #3
r_h-l commentedAltered the code to make that call nullsafe
e.shadowRoot?.querySelectorAll(`:is(${n})`+s)Which then resulted in the element being removed entirely from the DOM so that's less than ideal. Could a feature be added to have an "Always Scan these" for hidden things like accordions, or is there a method for making them scannable?
Comment #4
itmaybejj commentedAfraid I won't be able to take a look for another week or two.
Sounds like two bugs most likely -- I'll have to make sure config is being passed correctly, and then make it resistant to nulls.
Are you able to tell me which URL can demonstrate the issue?
Comment #5
itmaybejj commentedComment #6
r_h-l commentedUnfortunately, all of our sites are access controlled by Single Sign On, so I can't give access.
Comment #8
itmaybejj commentedI was able to replicate an issue when defining an element as a shadow host that exists, but does not have a shadow root at the time of the test run. Holler if 2.0.14 doesn't fix your issue.
Comment #9
r_h-l commentedAwesome. Seems to work, and scans within our accordion panels, as expected. Thank you!
Comment #11
r_h-l commented@itmaybejj It looks like the nullsafe operation got removed at some point, and is causing this issue again
Comment #12
itmaybejj commentedComment #13
itmaybejj commentedThis bug does not appear to be present in the 3.x branch.
Comment #15
itmaybejj commentedComment #17
itmaybejj commentedFixed in 2.2.21