-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
a11y-label-has-associated-control
audit produces false positives
#9456
Comments
I think it looks weird how the Audit message is being chopped up under normal viewport and looks fine by reducing the tab width via Chrome DevTools, I do wanna know how to type this Issue out to |
Thanks for the report. For more information, the rule details are located here. {
code: 'a11y-label-has-associated-control',
title: '`label` tag should have an associated control and a text content.',
message:
'The `label` tag must be associated with a control using either `for` or having a nested input. Additionally, the `label` tag must have text content.',
selector: 'label:not([for])',
match(element) {
const inputChild = element.querySelector('input');
if (!inputChild?.textContent) return true;
},
}, It looks like that after matching the This may need a second pair of eyes but my initial thinking is that this is a false positive that should be fixed upstream (and maybe a message tweak to not only mention
I think this one should be covered by this issue #9346 |
I agree with @HiDeoo that this is a false positive and should be fixed in the Astro repo. Just as extra confirmation, neither Firefox’s built-in a11y tests nor axe Dev Tools report this issue, and looking at the accessibility tree for the language switcher (for example) shows labels working as expected: I will transfer this over to the |
a11y-label-has-associated-control
audit produces false positives
Quick summary of why this was moved from the Starlight repo: The See @HiDeoo’s comment for links to a similar ESLint rule, which accounts for this. |
What version of
starlight
are you using?0.15.0
What version of
astro
are you using?4.0.1
What package manager are you using?
pnpm
What operating system are you using?
Windows
What browser are you using?
Chrome
Describe the Bug
According to
Dev Toolbar Audit
the labels used forThemeSelect
&LanguageSelect
are missing its controlled textComplete Error according to Dev Toolbar ⬇
Link to component found from Audit: Select Component
Screenshots ⬇️
Link to Minimal Reproducible Example
Not applicable
Participation
The text was updated successfully, but these errors were encountered: