-
Notifications
You must be signed in to change notification settings - Fork 784
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: flag unsupported roles #1064
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,18 +46,30 @@ module.exports = function(grunt) { | |
.reduce((out, [key] = item) => { | ||
switch (listType) { | ||
case 'supported': | ||
if (subject.includes(key)) { | ||
if ( | ||
subject.hasOwnProperty(key) && | ||
subject[key].unsupported === false | ||
) { | ||
out.push([`${key}`, 'Yes']); | ||
} | ||
break; | ||
case 'unsupported': | ||
if (!subject.includes(key)) { | ||
if ( | ||
(subject[key] && subject[key].unsupported === true) || | ||
!subject.hasOwnProperty(key) | ||
) { | ||
out.push([`${key}`, 'No']); | ||
} | ||
break; | ||
case 'all': | ||
default: | ||
out.push([`${key}`, subject.includes(key) ? 'Yes' : 'No']); | ||
out.push([ | ||
`${key}`, | ||
subject.hasOwnProperty(key) && | ||
subject[key].unsupported === false | ||
? 'Yes' | ||
: 'No' | ||
]); | ||
break; | ||
} | ||
return out; | ||
|
@@ -75,14 +87,11 @@ module.exports = function(grunt) { | |
} in axe-core.`, | ||
mdTable([ | ||
['aria-role', 'axe-core support'], | ||
...getDiff(roles, Object.keys(axe.commons.aria.lookupTable.role)) | ||
...getDiff(roles, axe.commons.aria.lookupTable.role) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
]), | ||
mdTable([ | ||
['aria-attribute', 'axe-core support'], | ||
...getDiff( | ||
aQaria, | ||
Object.keys(axe.commons.aria.lookupTable.attributes) | ||
) | ||
...getDiff(aQaria, axe.commons.aria.lookupTable.attributes) | ||
]) | ||
); | ||
grunt.file.write(destFile, content); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
return !axe.commons.aria.isValidRole(node.getAttribute('role'), { | ||
flagUnsupported: true | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"id": "unsupportedrole", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be hyphenated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was following There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, makes sense. I'm +1 for consistency, so no need to change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that I'm working on attributes, I wish we would have added a hyphen.... the role thing is inconsistent with the rest of axe-core checks. oh well... |
||
"evaluate": "unsupportedrole.js", | ||
"metadata": { | ||
"impact": "critical", | ||
"messages": { | ||
"pass": "ARIA role is supported", | ||
"fail": "The role used is not widely supported in assistive technologies" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this say "in screen readers", or "in screen readers and other assistive technologies"? Also, should we include the actual 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.
What's this template string for? This could just be
out.push(key, ...)
.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.
nit: Agree
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, that's a question for @JKODU
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.
@stephenmathieson @dylanb
out
is what eventually becomes the array to pass to mdTable like so - https://github.com/dequelabs/axe-core/blob/develop/build/tasks/aria-supported.js#L78And the generated output is here - https://github.com/dequelabs/axe-core/blob/develop/doc/aria-supported.md
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.
Right, but why are we wrapping a variable in backticks here? Consider the following: