Skip to content

Commit

Permalink
feat: element role mapping updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jlp-craigmorten committed Jul 29, 2024
1 parent b0bcd43 commit a69bbc4
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 24 deletions.
6 changes: 4 additions & 2 deletions __tests__/src/elementRoleMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ const entriesList = [
[{"name": "div"}, ["generic"]],
[{"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "footer"}, ["generic"]],
[{"constraints": ["scoped to the main element", "scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "header"}, ["generic"]],
[{"name": "hgroup"}, ["generic"]],
[{"name": "hgroup"}, ["group"]],
[{"name": "i"}, ["generic"]],
[{"name": "pre"}, ["generic"]],
[{"name": "q"}, ["generic"]],
[{"name": "s"}, ["deletion"]],
[{"name": "samp"}, ["generic"]],
[{"name": "search"}, ["search"]],
[{"name": "section"}, ["generic"]],
[{"name": "small"}, ["generic"]],
[{"name": "span"}, ["generic"]],
Expand Down Expand Up @@ -230,7 +232,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(
Expand Down
9 changes: 5 additions & 4 deletions __tests__/src/roleElementMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ const entriesList = [
["complementary", [{"constraints": ["scoped to the body element", "scoped to the main element"], "name": "aside"}, {"attributes": [{"constraints": ["set"], "name": "aria-label"}], "constraints": ["scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "aside"}, {"attributes": [{"constraints": ["set"], "name": "aria-labelledby"}], "constraints": ["scoped to a sectioning content element", "scoped to a sectioning root element other than body"], "name": "aside"}]],
["contentinfo", [{"constraints": ["scoped to the body element"], "name": "footer"}]],
["definition", [{"name": "dd"}]],
["deletion", [{"name": "del"}]],
["deletion", [{"name": "del"}, {"name": "s"}]],
["dialog", [{"name": "dialog"}]],
["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"}]],
["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"}]],
["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": "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"}]],
["group", [{"name": "details"}, {"name": "fieldset"}, {"name": "optgroup"}, {"name": "address"}]],
["group", [{"name": "address"}, {"name": "details"}, {"name": "fieldset"}, {"name": "hgroup"}, {"name": "optgroup"}]],
["heading", [{"name": "h1"}, {"name": "h2"}, {"name": "h3"}, {"name": "h4"}, {"name": "h5"}, {"name": "h6"}]],
["img", [{"attributes": [{"constraints": ["set"], "name": "alt"}], "name": "img"}, {"attributes": [{"constraints": ["undefined"], "name": "alt"}], "name": "img"}]],
["insertion", [{"name": "ins"}]],
Expand All @@ -47,6 +47,7 @@ const entriesList = [
["rowgroup", [{"name": "tbody"}, {"name": "tfoot"}, {"name": "thead"}]],
["rowheader", [{"attributes": [{"name": "scope", "value": "row"}], "name": "th"}, {"attributes": [{"name": "scope", "value": "rowgroup"}], "name": "th"}]],
["section", [{"attributes": [{"name": "aria-label"}], "name": "section"}, {"attributes": [{"name": "aria-labelledby"}], "name": "section"}]],
["search", [{"name": "search"}]],
["searchbox", [{"attributes": [{"constraints": ["undefined"], "name": "list"}, {"name": "type", "value": "search"}], "constraints": ["the list attribute is not set"], "name": "input"}]],
["separator", [{"name": "hr"}]],
["slider", [{"attributes": [{"name": "type", "value": "range"}], "name": "input"}]],
Expand Down Expand Up @@ -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(
Expand Down
31 changes: 22 additions & 9 deletions scripts/roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,12 @@
"name": "del"
},
"module": "HTML"
},
{
"concept": {
"name": "s"
},
"module": "HTML"
}
],
"requiredContextRole": [],
Expand Down Expand Up @@ -3109,12 +3115,6 @@
},
"module": "HTML"
},
{
"concept": {
"name": "hgroup"
},
"module": "HTML"
},
{
"concept": {
"name": "i"
Expand Down Expand Up @@ -3441,6 +3441,12 @@
"aria-roledescription"
],
"relatedConcepts": [
{
"concept": {
"name": "address"
},
"module": "HTML"
},
{
"concept": {
"name": "details"
Expand All @@ -3455,13 +3461,13 @@
},
{
"concept": {
"name": "optgroup"
"name": "hgroup"
},
"module": "HTML"
},
{
"concept": {
"name": "address"
"name": "optgroup"
},
"module": "HTML"
}
Expand Down Expand Up @@ -5168,7 +5174,14 @@
"aria-relevant",
"aria-roledescription"
],
"relatedConcepts": [],
"relatedConcepts": [
{
"concept": {
"name": "search"
},
"module": "HTML"
}
],
"requiredContextRole": [],
"requiredOwnedElements": [],
"requiredProps": [],
Expand Down
6 changes: 6 additions & 0 deletions src/etc/roles/literal/deletionRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const deletionRole: ARIARoleDefinition = {
},
module: 'HTML',
},
{
concept: {
name: 's',
},
module: 'HTML',
},
],
requireContextRole: [],
requiredContextRole: [],
Expand Down
6 changes: 0 additions & 6 deletions src/etc/roles/literal/genericRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ const genericRole: ARIARoleDefinition = {
},
module: 'HTML',
},
{
concept: {
name: 'hgroup',
},
module: 'HTML',
},
{
concept: {
name: 'i',
Expand Down
10 changes: 8 additions & 2 deletions src/etc/roles/literal/groupRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ const groupRole: ARIARoleDefinition = {
'aria-disabled': null,
},
relatedConcepts: [
{
concept: {
name: 'address',
},
module: 'HTML',
},
{
concept: {
name: 'details',
Expand All @@ -29,13 +35,13 @@ const groupRole: ARIARoleDefinition = {
},
{
concept: {
name: 'optgroup',
name: 'hgroup',
},
module: 'HTML',
},
{
concept: {
name: 'address',
name: 'optgroup',
},
module: 'HTML',
},
Expand Down
9 changes: 8 additions & 1 deletion src/etc/roles/literal/searchRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ const searchRole: ARIARoleDefinition = {
],
prohibitedProps: [],
props: {},
relatedConcepts: [],
relatedConcepts: [
{
concept: {
name: 'search',
},
module: 'HTML',
},
],
requireContextRole: [],
requiredContextRole: [],
requiredOwnedElements: [],
Expand Down

0 comments on commit a69bbc4

Please sign in to comment.