mark custom elements missing an open shadow for needs review if it fails a rule
See original GitHub issueIf a custom element is picked up by a rule it can fail under two cases which probably shouldn’t:
- the element isn’t defined in the
CustomElementRegistry
- the element is defined but uses a closed shadow root
It would be nice if axe-core detected these two cases and marked the element as needs review rather than fail it for any rule it fails.
We can easily detect the first case by using CustomElement.get
to see if the element name has been defined. For the 2nd case, it might be safe enough to assume that if the element is defined but does not have content or an open shadow root, it has a closed shadow root and we should mark it for needs review as we can’t tell for certain anything about the node.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Custom Element Best Practices - web.dev
Custom elements let you construct your own HTML tags. This checklist covers best practices to help you build high quality elements.
Read more >Prepare component for translation - Angular
To prepare your project for translation, complete the following actions. Use the i18n attribute to mark text in component templates; Use the i18n-...
Read more >5. Working with the Shadow DOM - Modern JavaScript [Book]
Shadow DOM is an adjunct tree of DOM nodes. These shadow DOM subtrees can be associated with an element, but do not appear...
Read more >What happened to web components? - LogRocket Blog
Attach a shadow DOM tree to the custom element's constructor using the Element.attachShadow() method. This step is optional and only applicable ...
Read more >Snakefiles and Rules — Snakemake 7.19.1 documentation
Instead of a shell command, a rule can run some python code to generate the output: rule NAME: input: "path/to/inputfile" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 for case 2; we just hit a case today where an Accessibility Insights user contacted us about a false positive in the
aria-required-parent
rule where a custom element of form<custom-tree-item role="treeitem" />
is slotted into a<div role="group">
that is hidden behind a closed shadow root. Repro codepen@brennanyoung until AOM is adopted and supported, custom element won’t expose any accessibility semantics by themselves. So a user would have to add all that information themselves to the DOM.