-
-
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
fix(a11y): Fix some audit false positives #9483
Conversation
🦋 Changeset detectedLatest commit: 4860291 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
⚖️ Bundle Size CheckLatest commit: 4860291
|
packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look mostly good, just one question on implementation
packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts
Outdated
Show resolved
Hide resolved
packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts
Outdated
Show resolved
Hide resolved
packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated label audit makes sense to me! Left a couple of small comments, but LGTM 🙌
packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts
Outdated
Show resolved
Hide resolved
packages/astro/src/runtime/client/dev-overlay/plugins/audit/a11y.ts
Outdated
Show resolved
Hide resolved
const inputChild = element.querySelector('input'); | ||
if (!inputChild?.textContent) return true; | ||
// Label must be associated with a control | ||
const hasFor = element.hasAttribute('for'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also be checking that the for
attribute element actually exists? Or does another audit take care of that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand what you mean. The line you highlighted checks for for
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I just got it, that the element the for is for exists, that's neat. We could do another rule for that, this rule is already a bit overloaded! I'll add it to the backlog.
…1y.ts Co-authored-by: Chris Swithinbank <[email protected]>
Changes
Some small false positives. Additionally rewrote a message to have the same form as the other messages.
Fix #9456
Fix #9422
Testing
Tested manually!
Docs
N/A