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.
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.
"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.
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.
straker
left a comment
There was a problem hiding this comment.
See comment above about merging
Closes: #4068