Skip to content
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(aria-roles): Add WAI-ARIA 1.2 roles #2544

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 39 additions & 0 deletions lib/standards/aria-roles.js
Expand Up @@ -39,11 +39,18 @@ const ariaRoles = {
type: 'landmark',
allowedAttrs: ['aria-expanded']
},
blockquote: {
type: 'structure'
},
button: {
type: 'widget',
allowedAttrs: ['aria-expanded', 'aria-pressed'],
nameFromContent: true
},
caption: {
type: 'structure',
requiredContext: ['figure', 'table', 'grid']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
requiredContext: ['figure', 'table', 'grid']
requiredContext: ['figure', 'table', 'grid', 'treegrid']

},
cell: {
type: 'structure',
requiredContext: ['row'],
Expand All @@ -67,6 +74,9 @@ const ariaRoles = {
allowedAttrs: ['aria-checked', 'aria-readonly', 'aria-required'],
nameFromContent: true
},
code: {
type: 'structure'
},
columnheader: {
type: 'structure',
requiredContext: ['row'],
Expand Down Expand Up @@ -117,6 +127,9 @@ const ariaRoles = {
type: 'structure',
allowedAttrs: ['aria-expanded']
},
deletion: {
type: 'structure'
},
dialog: {
type: 'widget',
allowedAttrs: ['aria-expanded', 'aria-modal']
Expand All @@ -131,6 +144,9 @@ const ariaRoles = {
type: 'structure',
allowedAttrs: ['aria-expanded']
},
emphasis: {
type: 'structure'
},
feed: {
type: 'structure',
requiredOwned: ['article'],
Expand Down Expand Up @@ -191,6 +207,9 @@ const ariaRoles = {
input: {
type: 'abstract'
},
insertion: {
type: 'structure'
},
landmark: {
type: 'abstract'
},
Expand Down Expand Up @@ -284,6 +303,11 @@ const ariaRoles = {
],
nameFromContent: true
},
meter: {
type: 'structure',
allowedAttrs: ['aria-valuetext'],
requiredAttrs: ['aria-valuemax', 'aria-valuemin', 'aria-valuenow']
straker marked this conversation as resolved.
Show resolved Hide resolved
},
navigation: {
type: 'landmark',
allowedAttrs: ['aria-expanded']
Expand All @@ -309,6 +333,9 @@ const ariaRoles = {
],
nameFromContent: true
},
paragraph: {
type: 'structure'
},
presentation: {
type: 'structure'
},
Expand Down Expand Up @@ -488,9 +515,18 @@ const ariaRoles = {
type: 'widget',
allowedAttrs: ['aria-expanded']
},
strong: {
type: 'structure'
},
structure: {
type: 'abstract'
},
subscript: {
type: 'structure'
},
superscript: {
type: 'structure'
},
switch: {
type: 'widget',
requiredAttrs: ['aria-checked'],
Expand Down Expand Up @@ -552,6 +588,9 @@ const ariaRoles = {
'aria-required'
]
},
time: {
type: 'structure'
},
timer: {
type: 'widget',
allowedAttrs: ['aria-expanded']
Expand Down
12 changes: 12 additions & 0 deletions test/commons/standards/get-aria-roles-by-type.js
Expand Up @@ -14,28 +14,40 @@ describe('standards.getAriaRolesByType', function() {
var structureRoles = getAriaRolesByType('structure');
assert.deepEqual(structureRoles, [
'article',
'blockquote',
'caption',
'cell',
'code',
'columnheader',
'definition',
'deletion',
'directory',
'document',
'emphasis',
'feed',
'figure',
'group',
'heading',
'img',
'insertion',
'list',
'listitem',
'math',
'meter',
'none',
'note',
'paragraph',
'presentation',
'row',
'rowgroup',
'rowheader',
'separator',
'strong',
'subscript',
'superscript',
'table',
'term',
'time',
'toolbar',
'tooltip'
]);
Expand Down