Skip to content

Commit 75803f7

Browse files
feat: element role mapping updates
1 parent f347e71 commit 75803f7

File tree

7 files changed

+53
-24
lines changed

7 files changed

+53
-24
lines changed

__tests__/src/elementRoleMap-test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ const entriesList = [
5252
[{"name": "div"}, ["generic"]],
5353
[{"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "footer"}, ["generic"]],
5454
[{"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "header"}, ["generic"]],
55-
[{"name": "hgroup"}, ["generic"]],
55+
[{"name": "hgroup"}, ["group"]],
5656
[{"name": "i"}, ["generic"]],
5757
[{"name": "pre"}, ["generic"]],
5858
[{"name": "q"}, ["generic"]],
59+
[{"name": "s"}, ["deletion"]],
5960
[{"name": "samp"}, ["generic"]],
61+
[{"name": "search"}, ["search"]],
6062
[{"name": "section"}, ["generic"]],
6163
[{"name": "small"}, ["generic"]],
6264
[{"name": "span"}, ["generic"]],
@@ -131,7 +133,7 @@ const entriesList = [
131133
test('elementRoleMap API', (t) => {
132134
const predicate = (obj, [o]) => deepEqual(o, obj);
133135

134-
testIteration(t, elementRoleMap, entriesList, 112, predicate);
136+
testIteration(t, elementRoleMap, entriesList, 114, predicate);
135137

136138
testForEach(t, elementRoleMap, entriesList, predicate);
137139

__tests__/src/roleElementMap-test.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ const entriesList = [
2222
["complementary", [{"constraints": ["scoped to the body element", "scoped to the main element"], "name": "aside"}, {"attributes": [{"constraints": ["set"], "name": "aria-label"}], "constraints": ["scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "aside"}, {"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "constraints": ["scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "aside"}]],
2323
["contentinfo", [{"constraints": ["scoped to the body element"], "name": "footer"}]],
2424
["definition", [{"name": "dd"}]],
25-
["deletion", [{"name": "del"}]],
25+
["deletion", [{"name": "del"}, {"name": "s"}]],
2626
["dialog", [{"name": "dialog"}]],
2727
["document", [{"name": "html"}]],
2828
["emphasis", [{"name": "em"}]],
2929
["figure", [{"name": "figure"}]],
3030
["form", [{"attributes": [{"constraints": ["set"], "name": "aria-label"}], "name": "form"}, {"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "name": "form"}, {"attributes": [{"constraints": ["set"], "name": "name"}], "name": "form"}]],
31-
["generic", [{"name": "a"}, {"name": "area"}, {"name": "aside"}, {"name": "b"}, {"name": "bdo"}, {"name": "body"}, {"name": "data"}, {"name": "div"}, {"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "footer"}, {"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "header"}, {"name": "hgroup"}, {"name": "i"}, {"name": "pre"}, {"name": "q"}, {"name": "samp"}, {"name": "section"}, {"name": "small"}, {"name": "span"}, {"name": "u"}]],
31+
["generic", [{"name": "a"}, {"name": "area"}, {"name": "aside"}, {"name": "b"}, {"name": "bdo"}, {"name": "body"}, {"name": "data"}, {"name": "div"}, {"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "footer"}, {"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "header"}, {"name": "i"}, {"name": "pre"}, {"name": "q"}, {"name": "samp"}, {"name": "section"}, {"name": "small"}, {"name": "span"}, {"name": "u"}]],
3232
["grid", [{"attributes": [{"name": "role", "value": "grid"}], "name": "table"}]],
3333
["gridcell", [{"constraints": ["ancestor table element has grid role", "ancestor table element has treegrid role"], "name": "td"}]],
34-
["group", [{"name": "details"}, {"name": "fieldset"}, {"name": "optgroup"}, {"name": "address"}]],
34+
["group", [{"name": "address"}, {"name": "details"}, {"name": "fieldset"}, {"name": "hgroup"}, {"name": "optgroup"}]],
3535
["heading", [{"name": "h1"}, {"name": "h2"}, {"name": "h3"}, {"name": "h4"}, {"name": "h5"}, {"name": "h6"}]],
3636
["img", [{"attributes": [{"constraints": ["set"], "name": "alt"}], "name": "img"}, {"attributes": [{"constraints": ["undefined"], "name": "alt"}], "name": "img"}]],
3737
["insertion", [{"name": "ins"}]],
@@ -54,6 +54,7 @@ const entriesList = [
5454
["rowgroup", [{"name": "tbody"}, {"name": "tfoot"}, {"name": "thead"}]],
5555
["rowheader", [{"attributes": [{"name": "scope", "value": "row"}], "name": "th"}, {"attributes": [{"name": "scope", "value": "rowgroup"}], "name": "th"}]],
5656
["section", [{"attributes": [{"name": "aria-label"}], "name": "section"}, {"attributes": [{"name": "aria-labelledby"}], "name": "section"}]],
57+
["search", [{"name": "search"}]],
5758
["searchbox", [{"attributes": [{"constraints": ["undefined"], "name": "list"}, {"name": "type", "value": "search"}], "constraints": ["the list attribute is not set"], "name": "input"}]],
5859
["separator", [{"name": "hr"}]],
5960
["slider", [{"attributes": [{"name": "type", "value": "range"}], "name": "input"}]],
@@ -72,7 +73,7 @@ const entriesList = [
7273
test('roleElementMap API', (t) => {
7374
const predicate = (role, [r]) => role === r;
7475

75-
testIteration(t, roleElementMap, entriesList, 55, predicate);
76+
testIteration(t, roleElementMap, entriesList, 56, predicate);
7677

7778
testForEach(t, roleElementMap, entriesList, predicate);
7879

scripts/roles.json

+22-9
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,12 @@
988988
"name": "del"
989989
},
990990
"module": "HTML"
991+
},
992+
{
993+
"concept": {
994+
"name": "s"
995+
},
996+
"module": "HTML"
991997
}
992998
],
993999
"requiredContextRole": [],
@@ -3109,12 +3115,6 @@
31093115
},
31103116
"module": "HTML"
31113117
},
3112-
{
3113-
"concept": {
3114-
"name": "hgroup"
3115-
},
3116-
"module": "HTML"
3117-
},
31183118
{
31193119
"concept": {
31203120
"name": "i"
@@ -3441,6 +3441,12 @@
34413441
"aria-roledescription"
34423442
],
34433443
"relatedConcepts": [
3444+
{
3445+
"concept": {
3446+
"name": "address"
3447+
},
3448+
"module": "HTML"
3449+
},
34443450
{
34453451
"concept": {
34463452
"name": "details"
@@ -3455,13 +3461,13 @@
34553461
},
34563462
{
34573463
"concept": {
3458-
"name": "optgroup"
3464+
"name": "hgroup"
34593465
},
34603466
"module": "HTML"
34613467
},
34623468
{
34633469
"concept": {
3464-
"name": "address"
3470+
"name": "optgroup"
34653471
},
34663472
"module": "HTML"
34673473
}
@@ -5168,7 +5174,14 @@
51685174
"aria-relevant",
51695175
"aria-roledescription"
51705176
],
5171-
"relatedConcepts": [],
5177+
"relatedConcepts": [
5178+
{
5179+
"concept": {
5180+
"name": "search"
5181+
},
5182+
"module": "HTML"
5183+
}
5184+
],
51725185
"requiredContextRole": [],
51735186
"requiredOwnedElements": [],
51745187
"requiredProps": [],

src/etc/roles/literal/deletionRole.js

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ const deletionRole: ARIARoleDefinition = {
2121
},
2222
module: 'HTML',
2323
},
24+
{
25+
concept: {
26+
name: 's',
27+
},
28+
module: 'HTML',
29+
},
2430
],
2531
requireContextRole: [],
2632
requiredContextRole: [],

src/etc/roles/literal/genericRole.js

-6
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ const genericRole: ARIARoleDefinition = {
8585
},
8686
module: 'HTML',
8787
},
88-
{
89-
concept: {
90-
name: 'hgroup',
91-
},
92-
module: 'HTML',
93-
},
9488
{
9589
concept: {
9690
name: 'i',

src/etc/roles/literal/groupRole.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ const groupRole: ARIARoleDefinition = {
1515
'aria-disabled': null,
1616
},
1717
relatedConcepts: [
18+
{
19+
concept: {
20+
name: 'address',
21+
},
22+
module: 'HTML',
23+
},
1824
{
1925
concept: {
2026
name: 'details',
@@ -29,13 +35,13 @@ const groupRole: ARIARoleDefinition = {
2935
},
3036
{
3137
concept: {
32-
name: 'optgroup',
38+
name: 'hgroup',
3339
},
3440
module: 'HTML',
3541
},
3642
{
3743
concept: {
38-
name: 'address',
44+
name: 'optgroup',
3945
},
4046
module: 'HTML',
4147
},

src/etc/roles/literal/searchRole.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ const searchRole: ARIARoleDefinition = {
1111
],
1212
prohibitedProps: [],
1313
props: {},
14-
relatedConcepts: [],
14+
relatedConcepts: [
15+
{
16+
concept: {
17+
name: 'search',
18+
},
19+
module: 'HTML',
20+
},
21+
],
1522
requireContextRole: [],
1623
requiredContextRole: [],
1724
requiredOwnedElements: [],

0 commit comments

Comments
 (0)