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

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

R_H-L created an issue. See original summary.

r_h-l’s picture

I did also try some other selectors, including base tags and none worked.

r_h-l’s picture

Altered 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?

itmaybejj’s picture

Afraid 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?

itmaybejj’s picture

Assigned: Unassigned » itmaybejj
r_h-l’s picture

Unfortunately, all of our sites are access controlled by Single Sign On, so I can't give access.

  • itmaybejj committed 6f174db3 on 2.0.x
    Issue #3379360 by R_H-L, itmaybejj: Use of ShadowRoot feature crashes...
itmaybejj’s picture

Status: Active » Fixed

I 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.

r_h-l’s picture

Awesome. Seems to work, and scans within our accordion panels, as expected. Thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

r_h-l’s picture

@itmaybejj It looks like the nullsafe operation got removed at some point, and is causing this issue again

itmaybejj’s picture

Status: Closed (fixed) » Needs work
itmaybejj’s picture

This bug does not appear to be present in the 3.x branch.

  • itmaybejj committed fba7ba34 on 2.2.x
    feat: #3379360 Use of ShadowRoot feature crashes checker.
    
    By: itmaybejj...
itmaybejj’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

itmaybejj’s picture

  • itmaybejj committed fba7ba34 on 2.2.x-dev
    feat: #3379360 Use of ShadowRoot feature crashes checker.
    
    By: itmaybejj...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.