Skip to content

Commit

Permalink
feat: add implicit role of graphics-document to svg element
Browse files Browse the repository at this point in the history
  • Loading branch information
jlp-craigmorten committed Sep 14, 2024
1 parent fab2d4a commit 091858b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion __tests__/src/elementRoleMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const entriesList = [
[{"name": "strong"}, ["strong"]],
[{"name": "sub"}, ["subscript"]],
[{"name": "sup"}, ["superscript"]],
[{"name": "svg"}, ["graphics-document"]],
[{"attributes": [{"name": "aria-checked"}], "name": "button"}, ["switch"]],
[{"name": "table"}, ["table"]],
[{"name": "dfn"}, ["term"]],
Expand All @@ -128,7 +129,7 @@ const entriesList = [
test('elementRoleMap API', async (t) => {
t.test('iteration', async (st) => {
st.notEqual(elementRoleMap[Symbol.iterator], undefined, 'has an iterator defined');
st.equal([...elementRoleMap].length, 112, 'has a specific length');
st.equal([...elementRoleMap].length, 113, 'has a specific length');

st.test('supports the spread operator', async (s2t) => {
[...elementRoleMap].forEach(([obj, roles]) => {
Expand Down
3 changes: 2 additions & 1 deletion __tests__/src/roleElementMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const entriesList = [
["strong", [{"name": "strong"}]],
["subscript", [{"name": "sub"}]],
["superscript", [{"name": "sup"}]],
["graphics-document", [{"name": "svg"}]],
["switch", [{"attributes": [{"name": "aria-checked"}], "name": "button"}]],
["table", [{"name": "table"}]],
["term", [{"name": "dfn"}, {"name": "dt"}]],
Expand All @@ -68,7 +69,7 @@ const entriesList = [
test('roleElementMap API', async (t) => {
t.test('iteration', async (st) => {
st.notEqual(roleElementMap[Symbol.iterator], undefined, 'has an iterator defined');
st.equal([...roleElementMap].length, 55, 'has a specific length');
st.equal([...roleElementMap].length, 56, 'has a specific length');

st.test('supports the spread operator', async (s2t) => {
[...roleElementMap].forEach(([role, elements]) => {
Expand Down
6 changes: 6 additions & 0 deletions scripts/roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,12 @@
"concept": {
"name": "article"
}
},
{
"concept": {
"name": "svg"
},
"module": "HTML"
}
],
"requiredContextRole": [],
Expand Down
6 changes: 6 additions & 0 deletions src/etc/roles/graphics/graphicsDocumentRole.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ const graphicsDocumentRole: ARIARoleDefinition = {
name: 'article',
},
},
{
concept: {
name: 'svg',
},
module: 'HTML',
},
],
requireContextRole: [],
requiredContextRole: [],
Expand Down

0 comments on commit 091858b

Please sign in to comment.