Skip to content

Commit

Permalink
fix: add missing doc-pagefooter and doc-pageheader roles
Browse files Browse the repository at this point in the history
  • Loading branch information
jlp-craigmorten authored and ljharb committed Apr 1, 2024
1 parent ccf831c commit 376caf7
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 1 deletion.
4 changes: 3 additions & 1 deletion __tests__/src/rolesMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions flow/aria.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ type ARIADPubRole =
| 'doc-noteref'
| 'doc-notice'
| 'doc-pagebreak'
| 'doc-pagefooter'
| 'doc-pageheader'
| 'doc-pagelist'
| 'doc-part'
| 'doc-preface'
Expand Down
76 changes: 76 additions & 0 deletions scripts/roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions src/etc/roles/ariaDpubRoles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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],
Expand Down
36 changes: 36 additions & 0 deletions src/etc/roles/dpub/docPagefooterRole.js
Original file line number Diff line number Diff line change
@@ -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;
36 changes: 36 additions & 0 deletions src/etc/roles/dpub/docPageheaderRole.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 376caf7

Please sign in to comment.