axe-core
axe-core copied to clipboard
[axe-extension] Dom error when insert a iframe
Product
axe-core
Product Version
4.8.2
Latest Version
- [X] I have tested the issue with the latest version of the product
Issue Description
Expectation
No errors.
Actual
Console error:
Uncaught TypeError: Cannot read properties of undefined (reading 'appendChild')
at:
document.getElementsByTagName("head")[0].appendChild(ee)
The element quey result is a empty list, so the index 0 is undefined.
How to Reproduce
- Open a site, such as https://www.google.com/
- Execute the script:
var frame = document.createElement('iframe');
frame.setAttribute("sandbox", "");
document.body.append(frame);
Additional context
Chrome: 119.0.6045.160 (Official Build) (64-bit) axe Extension: 4.68.1
Thanks for the issue. I've let the appropriate team know.
Hi @woody-li.
Thanks for reporting this issue. The error message you are seeing should be benign. It's caused because some code in a 3rd-party dependency assumes there is a <head> element, but there's not one in the iframe you injected to the page. Aside from the error message itself, it shouldn't cause any problems.
Are there any problems you are noticing other than the error message?
Yeah, it doesn't metter about any feature. Only error log message.
@woody-li Thanks for the additional information.
Since it's not causing any issues, is coming from a 3rd-party package, and happens in this edge case, I'm going to go ahead and close this for now.
Thank you again for reporting it, though, and feel free to reach out if it starts causing problems.
I don't think it should be closed. Although it's a 3rd-party dependency, shouldn't we report it to the 3rd-party for solution?
Our customer thinks it's a web page bug in accessibility audit.
@woody-li
After investigating this more, it looks like that 3rd-party dependency shouldn't be included in this scenario you described. I'm re-opening the ticket. We'll work to get it addressed.
This issue was fixed in Axe Devtools Extension v4.73.0 release, so I am closing this ticket.