From 9a1b884d50b71f4909076c0b7acf1b3094f8382c Mon Sep 17 00:00:00 2001 From: Huynh Duc Duy Date: Tue, 9 Apr 2024 22:05:06 +0700 Subject: [PATCH 1/3] fix: update role `none` to match role `presentation` --- scripts/roles.json | 39 +++++++++++++++++++++++++++---- src/etc/roles/literal/noneRole.js | 31 ++++++++++++++++++++---- 2 files changed, 61 insertions(+), 9 deletions(-) diff --git a/scripts/roles.json b/scripts/roles.json index 2d77a597..7e2ed3ac 100644 --- a/scripts/roles.json +++ b/scripts/roles.json @@ -4482,14 +4482,43 @@ "abstract": false, "accessibleNameRequired": false, "childrenPresentational": false, - "nameFrom": [], - "prohibitedProps": [], - "props": [], - "relatedConcepts": [], + "nameFrom": ["prohibited"], + "prohibitedProps": ["aria-label", "aria-labelledby"], + "props": [ + "aria-atomic", + "aria-busy", + "aria-controls", + "aria-current", + "aria-describedby", + "aria-details", + "aria-dropeffect", + "aria-flowto", + "aria-grabbed", + "aria-hidden", + "aria-keyshortcuts", + "aria-live", + "aria-owns", + "aria-relevant", + "aria-roledescription" + ], + "relatedConcepts": [ + { + "concept": { + "attributes": [ + { + "name": "alt", + "value": "" + } + ], + "name": "img" + }, + "module": "HTML" + } + ], "requiredContextRole": [], "requiredOwnedElements": [], "requiredProps": [], - "superClass": [] + "superClass": ["structure"] }, "note": { "abstract": false, diff --git a/src/etc/roles/literal/noneRole.js b/src/etc/roles/literal/noneRole.js index a4a244ae..fa4dc01a 100644 --- a/src/etc/roles/literal/noneRole.js +++ b/src/etc/roles/literal/noneRole.js @@ -6,15 +6,38 @@ const noneRole: ARIARoleDefinition = { accessibleNameRequired: false, baseConcepts: [], childrenPresentational: false, - nameFrom: [], - prohibitedProps: [], + nameFrom: [ + 'prohibited', + ], + prohibitedProps: [ + 'aria-label', + 'aria-labelledby', + ], props: {}, - relatedConcepts: [], + relatedConcepts: [ + { + concept: { + attributes: [ + { + name: 'alt', + value: '', + }, + ], + name: 'img', + }, + module: 'HTML', + }, + ], requireContextRole: [], requiredContextRole: [], requiredOwnedElements: [], requiredProps: {}, - superClass: [], + superClass: [ + [ + 'roletype', + 'structure', + ], + ], }; export default noneRole; \ No newline at end of file From 702081997691ec327064e3037fc119412be1f688 Mon Sep 17 00:00:00 2001 From: Huynh Duc Duy Date: Tue, 9 Apr 2024 22:05:23 +0700 Subject: [PATCH 2/3] feat: add tests for role `none` --- __tests__/src/elementRoleMap-test.js | 3 ++- __tests__/src/roleElementMap-test.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/__tests__/src/elementRoleMap-test.js b/__tests__/src/elementRoleMap-test.js index 9f9968e9..6995708d 100644 --- a/__tests__/src/elementRoleMap-test.js +++ b/__tests__/src/elementRoleMap-test.js @@ -87,6 +87,7 @@ const entriesList = [ [{"name": "option"}, ["option"]], [{"name": "p"}, ["paragraph"]], [{"attributes": [{"name": "alt", "value": ""}], "name": "img"}, ["presentation"]], + [{"attributes": [{"name": "alt", "value": ""}], "name": "img"}, ["none"]], [{"name": "progress"}, ["progressbar"]], [{"attributes": [{"name": "aria-valuemax"}, {"name": "aria-valuemin", "value": 0}, {"name": "aria-valuenow"}], "constraints": ["the progress bar is determinate"],"name": "progress"}, ["progressbar"]], [{"attributes": [{"name": "type", "value": "radio"}], "name": "input"}, ["radio"]], @@ -230,7 +231,7 @@ describe('elementRolesMap', function () { }); describe('spread operator', function () { it('should have a specific length', function () { - expect([...elementRoleMap].length).toEqual(112); + expect([...elementRoleMap].length).toEqual(114); }); 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 2a31189a..acbc361f 100644 --- a/__tests__/src/roleElementMap-test.js +++ b/__tests__/src/roleElementMap-test.js @@ -40,6 +40,7 @@ const entriesList = [ ["option", [{"name": "option"}]], ["paragraph", [{"name": "p"}]], ["presentation", [{"attributes": [{"name": "alt", "value": ""}], "name": "img"}]], + ["none", [{"attributes": [{"name": "alt", "value": ""}], "name": "img"}]], ["progressbar", [{"name": "progress"}]], ["radio", [{"attributes": [{"name": "type", "value": "radio"}], "name": "input"}]], ["region", [{"attributes": [{"constraints": ["set"], "name": "aria-label"}], "name": "section"}, {"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "name": "section"}]], @@ -146,7 +147,7 @@ describe('roleElementMap', function () { }); describe('spread operator', function () { it('should have a specific length', function () { - expect([...roleElementMap].length).toEqual(55); + expect([...roleElementMap].length).toEqual(56); }); test.each([...roleElementMap])('Testing element: %o', (obj, roles) => { expect(entriesList).toEqual( From b357c51dbfe09d67c03249072ad487096fa15bd5 Mon Sep 17 00:00:00 2001 From: Huynh Duc Duy Date: Tue, 9 Apr 2024 22:07:06 +0700 Subject: [PATCH 3/3] fix: update superClass of role `doc-pullquote` to match DPub-ARIA 1.1 --- scripts/roles.json | 2 +- src/etc/roles/dpub/docPullquoteRole.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/roles.json b/scripts/roles.json index 7e2ed3ac..5ed25e66 100644 --- a/scripts/roles.json +++ b/scripts/roles.json @@ -2625,7 +2625,7 @@ "requiredContextRole": [], "requiredOwnedElements": [], "requiredProps": [], - "superClass": ["none"] + "superClass": ["section"] }, "doc-qna": { "abstract": false, diff --git a/src/etc/roles/dpub/docPullquoteRole.js b/src/etc/roles/dpub/docPullquoteRole.js index 0ad4f53a..a73db2e5 100644 --- a/src/etc/roles/dpub/docPullquoteRole.js +++ b/src/etc/roles/dpub/docPullquoteRole.js @@ -25,7 +25,9 @@ const docPullquoteRole: ARIARoleDefinition = { requiredProps: {}, superClass: [ [ - 'none', + 'roletype', + 'structure', + 'section', ], ], };