Skip to content

Commit

Permalink
fix: The <form> element now always exposes the role "form"
Browse files Browse the repository at this point in the history
This has been changed in the ARIA spec in
w3c/html-aria#402.

See also testing-library/dom-testing-library#1293
  • Loading branch information
julienw committed Mar 15, 2024
1 parent fff6f07 commit adb2927
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 42 deletions.
6 changes: 2 additions & 4 deletions __tests__/src/elementRoleMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ const entriesList = [
[{"name": "em"}, ["emphasis"]],
[{"name": "html"}, ["document"]],
[{"name": "figure"}, ["figure"]],
[{"attributes": [{"constraints": ["set"], "name": "aria-label"}], "name": "form"}, ["form"]],
[{"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "name": "form"}, ["form"]],
[{"attributes": [{"constraints": ["set"], "name": "name"}], "name": "form"}, ["form"]],
[{"name": "form"}, ["form"]],
[{"name": "a"}, ["generic"]],
[{"name": "area"}, ["generic"]],
[{"name": "aside"}, ["generic"]],
Expand Down Expand Up @@ -230,7 +228,7 @@ describe('elementRolesMap', function () {
});
describe('spread operator', function () {
it('should have a specific length', function () {
expect([...elementRoleMap].length).toEqual(113);
expect([...elementRoleMap].length).toEqual(111);
});
test.each([...elementRoleMap])('Testing element: %o', (obj, roles) => {
expect(entriesList).toEqual(
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/roleElementMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const entriesList = [
["document", [{"name": "html"}]],
["emphasis", [{"name": "em"}]],
["figure", [{"name": "figure"}]],
["form", [{"attributes": [{"constraints": ["set"], "name": "aria-label"}], "name": "form"}, {"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "name": "form"}, {"attributes": [{"constraints": ["set"], "name": "name"}], "name": "form"}]],
["form", [{"name": "form"}]],
["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"}]],
["grid", [{"attributes": [{"name": "role", "value": "grid"}], "name": "table"}]],
["gridcell", [{"constraints": ["ancestor table element has grid role", "ancestor table element has treegrid role"], "name": "td"}]],
Expand Down
38 changes: 1 addition & 37 deletions src/etc/roles/literal/formRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,6 @@ const formRole: ARIARoleDefinition = {
relatedConcepts: [
{
concept: {
attributes: [
{
constraints: [
'set',
],
name: 'aria-label',
},
],
name: 'form',
},
module: 'HTML',
},
{
concept: {
attributes: [
{
constraints: [
'set',
],
name: 'aria-labelledby',
},
],
name: 'form',
},
module: 'HTML',
},
{
concept: {
attributes: [
{
constraints: [
'set',
],
name: 'name',
},
],
name: 'form',
},
module: 'HTML',
Expand All @@ -69,4 +33,4 @@ const formRole: ARIARoleDefinition = {
],
};

export default formRole;
export default formRole;

0 comments on commit adb2927

Please sign in to comment.