-
Notifications
You must be signed in to change notification settings - Fork 794
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(rule): aria-roledescription #1745
Conversation
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.
What about the documentation?
Added a couple of comments that you should address
test/integration/rules/aria-roledescription/aria-roledescription.html
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.
Some nitpick inline comments.
@@ -0,0 +1,14 @@ | |||
options = options || {}; |
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.
nitpick, destructuring will be easier to read & will remove line 4.
const { supportedRoles = [] } = options
return true; | ||
} | ||
|
||
if (role && role !== 'presentation' && role !== 'none') { |
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.
nitpick, exit early again easier to read.
if(!role) {
return false
}
if(!['presentation', 'none'].includes(role)) {
return undefined
}
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.
Disagree. There is a single "exit early" condition here. Splitting that over two if-statements is confusing. Readability isn't just about having shorter statements.
return true; | ||
} | ||
|
||
if (role && role !== 'presentation' && role !== 'none') { |
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.
Disagree. There is a single "exit early" condition here. Splitting that over two if-statements is confusing. Readability isn't just about having shorter statements.
Aria-roledescription required too many nuances that couldn't adequately be captured in just an
unsupported
object:As such, it was easier to turn it into its own rule that could capture these nuances. This is the same problem we'll encounter when trying to support
role="text"
as we'd want to make sure that it isn't used on an element with interactive children (something else that can't be captured in anunsupported
object).Closes issue: #1517
Reviewer checks
Required fields, to be filled out by PR reviewer(s)