Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore a11y checks on child components #1110

Closed
taylorzane opened this issue Jan 15, 2018 · 2 comments
Closed

Ignore a11y checks on child components #1110

taylorzane opened this issue Jan 15, 2018 · 2 comments
Labels

Comments

@taylorzane
Copy link
Contributor

I just encountered an interesting "bug" of the a11y implementation. I have a component that uses scope as the prop name, and I get a warning that The scope attribute should only be used with elements. I feel that a11y should be disabled on component definitions. Here's the full error (including code)

src/Components/Foo/index.html (20:71) A11y: The scope attribute should only be used with <th> elements
18:   <div id="foo-id">
19:     <div class="foo-class">
20:       <Child scope="local"></Child>
                 ^
21:     </div>
22:   </div>
@taylorzane taylorzane mentioned this issue Jan 15, 2018
33 tasks
@Conduitry
Copy link
Member

At least until Svelte v2, we are merely suggesting and not enforcing that component names begin with a capital letter and regular elements begin with a lowercase letter. So we have to check whether the given element is actually intended as a component before skipping the a11y checks. validateElement.ts has a check for this near the top (node.name === ':Self' || node.name === ':Component' || validator.components.has(node.name)) which perhaps should be copied into a11y.ts, or perhaps which should be extracted into some utility function, or perhaps we should refactor that check out into validateHtml in index.ts somehow.

@Conduitry Conduitry added the bug label Jan 16, 2018
@Conduitry Conduitry added this to PR'd in Roadmap Jan 16, 2018
Rich-Harris added a commit that referenced this issue Jan 18, 2018
do not run a11y validation on child component elements
@Conduitry Conduitry removed this from PR'd in Roadmap Jan 18, 2018
@Rich-Harris
Copy link
Member

As of 1.52 component attributes are skipped during a11y checks — thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants