From adb2927f9d7406fa358e7146815212f0296a70a1 Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Fri, 15 Mar 2024 11:48:38 +0100 Subject: [PATCH] fix: The
element now always exposes the role "form" This has been changed in the ARIA spec in https://github.com/w3c/html-aria/pull/402. See also https://github.com/testing-library/dom-testing-library/issues/1293 --- __tests__/src/elementRoleMap-test.js | 6 ++--- __tests__/src/roleElementMap-test.js | 2 +- src/etc/roles/literal/formRole.js | 38 +--------------------------- 3 files changed, 4 insertions(+), 42 deletions(-) diff --git a/__tests__/src/elementRoleMap-test.js b/__tests__/src/elementRoleMap-test.js index 329d3976..66341b70 100644 --- a/__tests__/src/elementRoleMap-test.js +++ b/__tests__/src/elementRoleMap-test.js @@ -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"]], @@ -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( diff --git a/__tests__/src/roleElementMap-test.js b/__tests__/src/roleElementMap-test.js index ea213575..9013290a 100644 --- a/__tests__/src/roleElementMap-test.js +++ b/__tests__/src/roleElementMap-test.js @@ -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"}]], diff --git a/src/etc/roles/literal/formRole.js b/src/etc/roles/literal/formRole.js index 7e51354d..86549865 100644 --- a/src/etc/roles/literal/formRole.js +++ b/src/etc/roles/literal/formRole.js @@ -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', @@ -69,4 +33,4 @@ const formRole: ARIARoleDefinition = { ], }; -export default formRole; \ No newline at end of file +export default formRole;