Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f52b777

Browse files
committedMar 15, 2024·
fix: The <form> element now always exposes the role "form"
This has been changed in the ARIA spec in w3c/html-aria#402. See also testing-library/dom-testing-library#1293
1 parent fff6f07 commit f52b777

File tree

4 files changed

+3
-71
lines changed

4 files changed

+3
-71
lines changed
 

‎__tests__/src/elementRoleMap-test.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ const entriesList = [
3333
[{"name": "em"}, ["emphasis"]],
3434
[{"name": "html"}, ["document"]],
3535
[{"name": "figure"}, ["figure"]],
36-
[{"attributes": [{"constraints": ["set"], "name": "aria-label"}], "name": "form"}, ["form"]],
37-
[{"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "name": "form"}, ["form"]],
38-
[{"attributes": [{"constraints": ["set"], "name": "name"}], "name": "form"}, ["form"]],
36+
[{"name": "form"}, ["form"]],
3937
[{"name": "a"}, ["generic"]],
4038
[{"name": "area"}, ["generic"]],
4139
[{"name": "aside"}, ["generic"]],
@@ -230,7 +228,7 @@ describe('elementRolesMap', function () {
230228
});
231229
describe('spread operator', function () {
232230
it('should have a specific length', function () {
233-
expect([...elementRoleMap].length).toEqual(113);
231+
expect([...elementRoleMap].length).toEqual(111);
234232
});
235233
test.each([...elementRoleMap])('Testing element: %o', (obj, roles) => {
236234
expect(entriesList).toEqual(

‎__tests__/src/roleElementMap-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const entriesList = [
2020
["document", [{"name": "html"}]],
2121
["emphasis", [{"name": "em"}]],
2222
["figure", [{"name": "figure"}]],
23-
["form", [{"attributes": [{"constraints": ["set"], "name": "aria-label"}], "name": "form"}, {"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "name": "form"}, {"attributes": [{"constraints": ["set"], "name": "name"}], "name": "form"}]],
23+
["form", [{"name": "form"}]],
2424
["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"}]],
2525
["grid", [{"attributes": [{"name": "role", "value": "grid"}], "name": "table"}]],
2626
["gridcell", [{"constraints": ["ancestor table element has grid role", "ancestor table element has treegrid role"], "name": "td"}]],

‎scripts/roles.json

-30
Original file line numberDiff line numberDiff line change
@@ -2895,36 +2895,6 @@
28952895
"relatedConcepts": [
28962896
{
28972897
"concept": {
2898-
"attributes": [
2899-
{
2900-
"constraints": ["set"],
2901-
"name": "aria-label"
2902-
}
2903-
],
2904-
"name": "form"
2905-
},
2906-
"module": "HTML"
2907-
},
2908-
{
2909-
"concept": {
2910-
"attributes": [
2911-
{
2912-
"constraints": ["set"],
2913-
"name": "aria-labelledby"
2914-
}
2915-
],
2916-
"name": "form"
2917-
},
2918-
"module": "HTML"
2919-
},
2920-
{
2921-
"concept": {
2922-
"attributes": [
2923-
{
2924-
"constraints": ["set"],
2925-
"name": "name"
2926-
}
2927-
],
29282898
"name": "form"
29292899
},
29302900
"module": "HTML"

‎src/etc/roles/literal/formRole.js

-36
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,6 @@ const formRole: ARIARoleDefinition = {
1414
relatedConcepts: [
1515
{
1616
concept: {
17-
attributes: [
18-
{
19-
constraints: [
20-
'set',
21-
],
22-
name: 'aria-label',
23-
},
24-
],
25-
name: 'form',
26-
},
27-
module: 'HTML',
28-
},
29-
{
30-
concept: {
31-
attributes: [
32-
{
33-
constraints: [
34-
'set',
35-
],
36-
name: 'aria-labelledby',
37-
},
38-
],
39-
name: 'form',
40-
},
41-
module: 'HTML',
42-
},
43-
{
44-
concept: {
45-
attributes: [
46-
{
47-
constraints: [
48-
'set',
49-
],
50-
name: 'name',
51-
},
52-
],
5317
name: 'form',
5418
},
5519
module: 'HTML',

0 commit comments

Comments
 (0)
Please sign in to comment.