From 376caf733e86a81ddea9df95a325ea8826c08164 Mon Sep 17 00:00:00 2001 From: jlp-craigmorten Date: Mon, 1 Apr 2024 14:13:24 +0100 Subject: [PATCH] fix: add missing `doc-pagefooter` and `doc-pageheader` roles --- __tests__/src/rolesMap-test.js | 4 +- flow/aria.js | 2 + scripts/roles.json | 76 +++++++++++++++++++++++++ src/etc/roles/ariaDpubRoles.js | 4 ++ src/etc/roles/dpub/docPagefooterRole.js | 36 ++++++++++++ src/etc/roles/dpub/docPageheaderRole.js | 36 ++++++++++++ 6 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 src/etc/roles/dpub/docPagefooterRole.js create mode 100644 src/etc/roles/dpub/docPageheaderRole.js diff --git a/__tests__/src/rolesMap-test.js b/__tests__/src/rolesMap-test.js index ab94c19a..55b3cc98 100644 --- a/__tests__/src/rolesMap-test.js +++ b/__tests__/src/rolesMap-test.js @@ -128,6 +128,8 @@ const entriesList = [ ["doc-noteref", expect.any(Object)], ["doc-notice", expect.any(Object)], ["doc-pagebreak", expect.any(Object)], + ["doc-pagefooter", expect.any(Object)], + ["doc-pageheader", expect.any(Object)], ["doc-pagelist", expect.any(Object)], ["doc-part", expect.any(Object)], ["doc-preface", expect.any(Object)], @@ -218,7 +220,7 @@ describe('rolesMap', function () { }); describe('spread operator', function () { it('should have a specific length', function () { - expect([...rolesMap].length).toEqual(137); + expect([...rolesMap].length).toEqual(139); }); test.each([...rolesMap])('Testing element: %o', (obj, roles) => { expect(entriesList).toEqual( diff --git a/flow/aria.js b/flow/aria.js index b51ee2a6..2d2ca406 100644 --- a/flow/aria.js +++ b/flow/aria.js @@ -145,6 +145,8 @@ type ARIADPubRole = | 'doc-noteref' | 'doc-notice' | 'doc-pagebreak' + | 'doc-pagefooter' + | 'doc-pageheader' | 'doc-pagelist' | 'doc-part' | 'doc-preface' diff --git a/scripts/roles.json b/scripts/roles.json index 2fe75ec6..2d77a597 100644 --- a/scripts/roles.json +++ b/scripts/roles.json @@ -2359,6 +2359,82 @@ "requiredProps": [], "superClass": ["separator"] }, + "doc-pagefooter": { + "abstract": false, + "accessibleNameRequired": false, + "childrenPresentational": false, + "nameFrom": ["prohibited"], + "prohibitedProps": [], + "props": [ + "aria-atomic", + "aria-braillelabel", + "aria-brailleroledescription", + "aria-busy", + "aria-controls", + "aria-current", + "aria-describedby", + "aria-description", + "aria-details", + "aria-disabled", + "aria-dropeffect", + "aria-errormessage", + "aria-flowto", + "aria-grabbed", + "aria-haspopup", + "aria-hidden", + "aria-invalid", + "aria-keyshortcuts", + "aria-label", + "aria-labelledby", + "aria-live", + "aria-owns", + "aria-relevant", + "aria-roledescription" + ], + "relatedConcepts": [], + "requiredContextRole": [], + "requiredOwnedElements": [], + "requiredProps": [], + "superClass": ["section"] + }, + "doc-pageheader": { + "abstract": false, + "accessibleNameRequired": false, + "childrenPresentational": false, + "nameFrom": ["prohibited"], + "prohibitedProps": [], + "props": [ + "aria-atomic", + "aria-braillelabel", + "aria-brailleroledescription", + "aria-busy", + "aria-controls", + "aria-current", + "aria-describedby", + "aria-description", + "aria-details", + "aria-disabled", + "aria-dropeffect", + "aria-errormessage", + "aria-flowto", + "aria-grabbed", + "aria-haspopup", + "aria-hidden", + "aria-invalid", + "aria-keyshortcuts", + "aria-label", + "aria-labelledby", + "aria-live", + "aria-owns", + "aria-relevant", + "aria-roledescription" + ], + "relatedConcepts": [], + "requiredContextRole": [], + "requiredOwnedElements": [], + "requiredProps": [], + "superClass": ["section"] + }, "doc-pagelist": { "abstract": false, "accessibleNameRequired": false, diff --git a/src/etc/roles/ariaDpubRoles.js b/src/etc/roles/ariaDpubRoles.js index 711268bb..464b7925 100644 --- a/src/etc/roles/ariaDpubRoles.js +++ b/src/etc/roles/ariaDpubRoles.js @@ -31,6 +31,8 @@ import docIntroductionRole from './dpub/docIntroductionRole'; import docNoterefRole from './dpub/docNoterefRole'; import docNoticeRole from './dpub/docNoticeRole'; import docPagebreakRole from './dpub/docPagebreakRole'; +import docPagefooterRole from './dpub/docPagefooterRole'; +import docPageheaderRole from './dpub/docPageheaderRole'; import docPagelistRole from './dpub/docPagelistRole'; import docPartRole from './dpub/docPartRole'; import docPrefaceRole from './dpub/docPrefaceRole'; @@ -72,6 +74,8 @@ const ariaDpubRoles: RoleDefinitions = [ ['doc-noteref', docNoterefRole], ['doc-notice', docNoticeRole], ['doc-pagebreak', docPagebreakRole], + ['doc-pagefooter', docPagefooterRole], + ['doc-pageheader', docPageheaderRole], ['doc-pagelist', docPagelistRole], ['doc-part', docPartRole], ['doc-preface', docPrefaceRole], diff --git a/src/etc/roles/dpub/docPagefooterRole.js b/src/etc/roles/dpub/docPagefooterRole.js new file mode 100644 index 00000000..9de9cc82 --- /dev/null +++ b/src/etc/roles/dpub/docPagefooterRole.js @@ -0,0 +1,36 @@ +/** + * @flow + */ +const docPagefooterRole: ARIARoleDefinition = { + abstract: false, + accessibleNameRequired: false, + baseConcepts: [], + childrenPresentational: false, + nameFrom: [ + 'prohibited', + ], + prohibitedProps: [], + props: { + 'aria-braillelabel': null, + 'aria-brailleroledescription': null, + 'aria-description': null, + 'aria-disabled': null, + 'aria-errormessage': null, + 'aria-haspopup': null, + 'aria-invalid': null, + }, + relatedConcepts: [], + requireContextRole: [], + requiredContextRole: [], + requiredOwnedElements: [], + requiredProps: {}, + superClass: [ + [ + 'roletype', + 'structure', + 'section', + ], + ], +}; + +export default docPagefooterRole; \ No newline at end of file diff --git a/src/etc/roles/dpub/docPageheaderRole.js b/src/etc/roles/dpub/docPageheaderRole.js new file mode 100644 index 00000000..e0035b3c --- /dev/null +++ b/src/etc/roles/dpub/docPageheaderRole.js @@ -0,0 +1,36 @@ +/** + * @flow + */ +const docPageheaderRole: ARIARoleDefinition = { + abstract: false, + accessibleNameRequired: false, + baseConcepts: [], + childrenPresentational: false, + nameFrom: [ + 'prohibited', + ], + prohibitedProps: [], + props: { + 'aria-braillelabel': null, + 'aria-brailleroledescription': null, + 'aria-description': null, + 'aria-disabled': null, + 'aria-errormessage': null, + 'aria-haspopup': null, + 'aria-invalid': null, + }, + relatedConcepts: [], + requireContextRole: [], + requiredContextRole: [], + requiredOwnedElements: [], + requiredProps: {}, + superClass: [ + [ + 'roletype', + 'structure', + 'section', + ], + ], +}; + +export default docPageheaderRole; \ No newline at end of file