Skip to content

Commit 18110d3

Browse files
feat: add new comment, image, and suggestion roles
TODO: update existing role props with `aria-braillelabel`, `aria-brailleroledescription`, and `aria-description`
1 parent 376caf7 commit 18110d3

File tree

6 files changed

+291
-1
lines changed

6 files changed

+291
-1
lines changed

scripts/roles.json

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,43 @@
775775
"requiredProps": [],
776776
"superClass": ["widget"]
777777
},
778+
"comment": {
779+
"abstract": false,
780+
"accessibleNameRequired": false,
781+
"childrenPresentational": false,
782+
"nameFrom": ["author", "contents"],
783+
"prohibitedProps": [],
784+
"props": [
785+
"aria-atomic",
786+
"aria-braillelabel",
787+
"aria-brailleroledescription",
788+
"aria-busy",
789+
"aria-controls",
790+
"aria-current",
791+
"aria-describedby",
792+
"aria-description",
793+
"aria-details",
794+
"aria-dropeffect",
795+
"aria-flowto",
796+
"aria-grabbed",
797+
"aria-hidden",
798+
"aria-keyshortcuts",
799+
"aria-level",
800+
"aria-label",
801+
"aria-labelledby",
802+
"aria-live",
803+
"aria-owns",
804+
"aria-posinset",
805+
"aria-relevant",
806+
"aria-roledescription",
807+
"aria-setsize"
808+
],
809+
"relatedConcepts": [],
810+
"requiredContextRole": [],
811+
"requiredOwnedElements": [],
812+
"requiredProps": [],
813+
"superClass": ["article"]
814+
},
778815
"complementary": {
779816
"abstract": false,
780817
"accessibleNameRequired": false,
@@ -3540,6 +3577,71 @@
35403577
"requiredProps": [["aria-level", "2"]],
35413578
"superClass": ["sectionhead"]
35423579
},
3580+
"image": {
3581+
"abstract": false,
3582+
"accessibleNameRequired": true,
3583+
"childrenPresentational": true,
3584+
"nameFrom": ["author"],
3585+
"prohibitedProps": [],
3586+
"props": [
3587+
"aria-atomic",
3588+
"aria-braillelabel",
3589+
"aria-brailleroledescription",
3590+
"aria-busy",
3591+
"aria-controls",
3592+
"aria-current",
3593+
"aria-describedby",
3594+
"aria-description",
3595+
"aria-details",
3596+
"aria-dropeffect",
3597+
"aria-flowto",
3598+
"aria-grabbed",
3599+
"aria-hidden",
3600+
"aria-keyshortcuts",
3601+
"aria-label",
3602+
"aria-labelledby",
3603+
"aria-live",
3604+
"aria-owns",
3605+
"aria-relevant",
3606+
"aria-roledescription"
3607+
],
3608+
"relatedConcepts": [
3609+
{
3610+
"concept": {
3611+
"attributes": [
3612+
{
3613+
"constraints": ["set"],
3614+
"name": "alt"
3615+
}
3616+
],
3617+
"name": "img"
3618+
},
3619+
"module": "HTML"
3620+
},
3621+
{
3622+
"concept": {
3623+
"attributes": [
3624+
{
3625+
"constraints": ["undefined"],
3626+
"name": "alt"
3627+
}
3628+
],
3629+
"name": "img"
3630+
},
3631+
"module": "HTML"
3632+
},
3633+
{
3634+
"concept": {
3635+
"name": "imggroup"
3636+
},
3637+
"module": "DTB"
3638+
}
3639+
],
3640+
"requiredContextRole": [],
3641+
"requiredOwnedElements": [],
3642+
"requiredProps": [],
3643+
"superClass": ["section"]
3644+
},
35433645
"img": {
35443646
"abstract": false,
35453647
"accessibleNameRequired": true,
@@ -3548,10 +3650,13 @@
35483650
"prohibitedProps": [],
35493651
"props": [
35503652
"aria-atomic",
3653+
"aria-braillelabel",
3654+
"aria-brailleroledescription",
35513655
"aria-busy",
35523656
"aria-controls",
35533657
"aria-current",
35543658
"aria-describedby",
3659+
"aria-description",
35553660
"aria-details",
35563661
"aria-dropeffect",
35573662
"aria-flowto",
@@ -5643,6 +5748,37 @@
56435748
"requiredProps": [],
56445749
"superClass": ["section"]
56455750
},
5751+
"suggestion": {
5752+
"abstract": false,
5753+
"accessibleNameRequired": false,
5754+
"childrenPresentational": false,
5755+
"nameFrom": ["prohibited"],
5756+
"prohibitedProps": ["aria-braillelabel", "aria-label", "aria-labelledby"],
5757+
"props": [
5758+
"aria-atomic",
5759+
"aria-brailleroledescription",
5760+
"aria-busy",
5761+
"aria-controls",
5762+
"aria-current",
5763+
"aria-describedby",
5764+
"aria-description",
5765+
"aria-details",
5766+
"aria-dropeffect",
5767+
"aria-flowto",
5768+
"aria-grabbed",
5769+
"aria-hidden",
5770+
"aria-keyshortcuts",
5771+
"aria-live",
5772+
"aria-owns",
5773+
"aria-relevant",
5774+
"aria-roledescription"
5775+
],
5776+
"relatedConcepts": [],
5777+
"requiredContextRole": [],
5778+
"requiredOwnedElements": [["insertion"], ["deletion"]],
5779+
"requiredProps": [],
5780+
"superClass": ["section"]
5781+
},
56465782
"superscript": {
56475783
"abstract": false,
56485784
"accessibleNameRequired": false,

src/etc/roles/ariaLiteralRoles.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import checkboxRole from './literal/checkboxRole';
1414
import codeRole from './literal/codeRole';
1515
import columnheaderRole from './literal/columnheaderRole';
1616
import comboboxRole from './literal/comboboxRole';
17+
import commentRole from './literal/commentRole';
1718
import complementaryRole from './literal/complementaryRole';
1819
import contentinfoRole from './literal/contentinfoRole';
1920
import definitionRole from './literal/definitionRole';
@@ -30,6 +31,7 @@ import gridRole from './literal/gridRole';
3031
import gridcellRole from './literal/gridcellRole';
3132
import groupRole from './literal/groupRole';
3233
import headingRole from './literal/headingRole';
34+
import imageRole from './literal/imageRole';
3335
import imgRole from './literal/imgRole';
3436
import insertionRole from './literal/insertionRole';
3537
import linkRole from './literal/linkRole';
@@ -69,6 +71,7 @@ import spinbuttonRole from './literal/spinbuttonRole';
6971
import statusRole from './literal/statusRole';
7072
import strongRole from './literal/strongRole';
7173
import subscriptRole from './literal/subscriptRole';
74+
import suggestionRole from './literal/suggestionRole';
7275
import superscriptRole from './literal/superscriptRole';
7376
import switchRole from './literal/switchRole';
7477
import tabRole from './literal/tabRole';
@@ -99,6 +102,7 @@ const ariaLiteralRoles: RoleDefinitions = [
99102
['code', codeRole],
100103
['columnheader', columnheaderRole],
101104
['combobox', comboboxRole],
105+
['comment', commentRole],
102106
['complementary', complementaryRole],
103107
['contentinfo', contentinfoRole],
104108
['definition', definitionRole],
@@ -115,6 +119,7 @@ const ariaLiteralRoles: RoleDefinitions = [
115119
['gridcell', gridcellRole],
116120
['group', groupRole],
117121
['heading', headingRole],
122+
['image', imageRole],
118123
['img', imgRole],
119124
['insertion', insertionRole],
120125
['link', linkRole],
@@ -154,6 +159,7 @@ const ariaLiteralRoles: RoleDefinitions = [
154159
['status', statusRole],
155160
['strong', strongRole],
156161
['subscript', subscriptRole],
162+
['suggestion', suggestionRole],
157163
['superscript', superscriptRole],
158164
['switch', switchRole],
159165
['tab', tabRole],

src/etc/roles/literal/commentRole.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @flow
3+
*/
4+
const commentRole: ARIARoleDefinition = {
5+
abstract: false,
6+
accessibleNameRequired: false,
7+
baseConcepts: [],
8+
childrenPresentational: false,
9+
nameFrom: [
10+
'author',
11+
'contents',
12+
],
13+
prohibitedProps: [],
14+
props: {
15+
'aria-braillelabel': null,
16+
'aria-brailleroledescription': null,
17+
'aria-description': null,
18+
'aria-level': null,
19+
},
20+
relatedConcepts: [],
21+
requireContextRole: [],
22+
requiredContextRole: [],
23+
requiredOwnedElements: [],
24+
requiredProps: {},
25+
superClass: [
26+
[
27+
'roletype',
28+
'structure',
29+
'document',
30+
'article',
31+
],
32+
],
33+
};
34+
35+
export default commentRole;

src/etc/roles/literal/imageRole.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/**
2+
* @flow
3+
*/
4+
const imageRole: ARIARoleDefinition = {
5+
abstract: false,
6+
accessibleNameRequired: true,
7+
baseConcepts: [],
8+
childrenPresentational: true,
9+
nameFrom: [
10+
'author',
11+
],
12+
prohibitedProps: [],
13+
props: {
14+
'aria-braillelabel': null,
15+
'aria-brailleroledescription': null,
16+
'aria-description': null,
17+
},
18+
relatedConcepts: [
19+
{
20+
concept: {
21+
attributes: [
22+
{
23+
constraints: [
24+
'set',
25+
],
26+
name: 'alt',
27+
},
28+
],
29+
name: 'img',
30+
},
31+
module: 'HTML',
32+
},
33+
{
34+
concept: {
35+
attributes: [
36+
{
37+
constraints: [
38+
'undefined',
39+
],
40+
name: 'alt',
41+
},
42+
],
43+
name: 'img',
44+
},
45+
module: 'HTML',
46+
},
47+
{
48+
concept: {
49+
name: 'imggroup',
50+
},
51+
module: 'DTB',
52+
},
53+
],
54+
requireContextRole: [],
55+
requiredContextRole: [],
56+
requiredOwnedElements: [],
57+
requiredProps: {},
58+
superClass: [
59+
[
60+
'roletype',
61+
'structure',
62+
'section',
63+
],
64+
],
65+
};
66+
67+
export default imageRole;

src/etc/roles/literal/imgRole.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ const imgRole: ARIARoleDefinition = {
1010
'author',
1111
],
1212
prohibitedProps: [],
13-
props: {},
13+
props: {
14+
'aria-braillelabel': null,
15+
'aria-brailleroledescription': null,
16+
'aria-description': null,
17+
},
1418
relatedConcepts: [
1519
{
1620
concept: {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* @flow
3+
*/
4+
const suggestionRole: ARIARoleDefinition = {
5+
abstract: false,
6+
accessibleNameRequired: false,
7+
baseConcepts: [],
8+
childrenPresentational: false,
9+
nameFrom: [
10+
'prohibited',
11+
],
12+
prohibitedProps: [
13+
'aria-braillelabel',
14+
'aria-label',
15+
'aria-labelledby',
16+
],
17+
props: {
18+
'aria-brailleroledescription': null,
19+
'aria-description': null,
20+
},
21+
relatedConcepts: [],
22+
requireContextRole: [],
23+
requiredContextRole: [],
24+
requiredOwnedElements: [
25+
[
26+
'insertion',
27+
],
28+
[
29+
'deletion',
30+
],
31+
],
32+
requiredProps: {},
33+
superClass: [
34+
[
35+
'roletype',
36+
'structure',
37+
'section',
38+
],
39+
],
40+
};
41+
42+
export default suggestionRole;

0 commit comments

Comments
 (0)