-
Notifications
You must be signed in to change notification settings - Fork 788
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
feat: add rule aria-conditional-attr #4094
Conversation
lib/rules/aria-conditional-attr.json
Outdated
"description": "Ensures ARIA attributes are used as described for the element's role", | ||
"help": "ARIA attributes must be used as described by the element's role" |
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.
I'm not sure this sentence helps clarify how the rule applies or why. Especially for aria-checked
which isn't based on the role but on the checked
state of the element, a condition which isn't stated in the aria-checked
spec. Maybe something like the following?
Ensures AIRA attributes are used correctly in certain scenarios
It isn't more specific, but does clarify that it's conditional to some set of scenarios where it's allowed to be used but with caveats.
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.
"certain scenarios" feels very vague. This checks that if the ARIA says the role has certain restrictions on when/how an attribute can be used, those restrictions are followed. How about:
"description": "Ensures ARIA attributes are used as described in the specification of the element's role",
"help": "ARIA attributes must be used as specified for the element's role"
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.
I think I'm getting tripped up on as described in the specification of the element's role
since what we are doing to validate aria-checked is not defined in any specification (instead the spec calls out to not use aria-checked
on an input type="checkbox"
). But I don't want to keep bikesheding this, so going to approve and you can feel free to merge or update the message.
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.
See comment above about merging
Closes: #4068