question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mark custom elements missing an open shadow for needs review if it fails a rule

See original GitHub issue

If a custom element is picked up by a rule it can fail under two cases which probably shouldn’t:

  1. the element isn’t defined in the CustomElementRegistry
  2. 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:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dbjorgecommented, Dec 18, 2020

+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

0reactions
strakercommented, Nov 9, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found