Skip to content

Commit b602ee9

Browse files
committed
Added algorithm support to prevent name on 'name prohibited' elements and roles in accordance with ARIA 1.2.
1 parent 7730830 commit b602ee9

File tree

4 files changed

+77
-12
lines changed

4 files changed

+77
-12
lines changed

docs/Editable Live Input AccName Test - Relative.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@
7979
</li>
8080
<li>
8181
Visual ARIA:
82-
<a target="github" href="https://github.com/AccDC/visual-aria"
83-
>https://github.com/AccDC/visual-aria</a
82+
<a target="github" href="https://github.com/whatsock/visual-aria"
83+
>https://github.com/whatsock/visual-aria</a
8484
>
8585
</li>
8686
<li>
8787
Visual ARIA Bookmarklet:
8888
<a
8989
target="github"
90-
href="https://accdc.github.io/visual-aria/github-bookmarklet/visual-aria.htm"
91-
>https://accdc.github.io/visual-aria/github-bookmarklet/visual-aria.htm</a
90+
href="https://whatsock.github.io/visual-aria/github-bookmarklet/visual-aria.htm"
91+
>https://whatsock.github.io/visual-aria/github-bookmarklet/visual-aria.htm</a
9292
>
9393
</li>
9494
</ul>

docs/Editable Live Input AccName Test.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@
7979
</li>
8080
<li>
8181
Visual ARIA:
82-
<a target="github" href="https://github.com/AccDC/visual-aria"
83-
>https://github.com/AccDC/visual-aria</a
82+
<a target="github" href="https://github.com/whatsock/visual-aria"
83+
>https://github.com/whatsock/visual-aria</a
8484
>
8585
</li>
8686
<li>
8787
Visual ARIA Bookmarklet:
8888
<a
8989
target="github"
90-
href="https://accdc.github.io/visual-aria/github-bookmarklet/visual-aria.htm"
91-
>https://accdc.github.io/visual-aria/github-bookmarklet/visual-aria.htm</a
90+
href="https://whatsock.github.io/visual-aria/github-bookmarklet/visual-aria.htm"
91+
>https://whatsock.github.io/visual-aria/github-bookmarklet/visual-aria.htm</a
9292
>
9393
</li>
9494
</ul>

docs/Sample JavaScript Recursion Algorithm/recursion.js

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Distributed under the terms of the Open Source Initiative OSI - MIT License
1414
window[nameSpace] = {};
1515
nameSpace = window[nameSpace];
1616
}
17-
nameSpace.getAccNameVersion = "2.59";
17+
nameSpace.getAccNameVersion = "2.60";
1818
// AccName Computation Prototype
1919
nameSpace.getAccName = nameSpace.calcNames = function(
2020
node,
@@ -372,6 +372,16 @@ Plus roles extended for the Role Parity project.
372372
return result;
373373
}
374374

375+
// Added to prevent name on roles that do not support a name.
376+
// https://www.w3.org/TR/wai-aria-1.2/#namefromprohibited
377+
var isProhibited =
378+
node === rootNode &&
379+
(nameProhibitedRoles.indexOf(nRole) !== -1 ||
380+
(!nRole && nameProhibitedElements.indexOf(nTag) !== -1));
381+
if (isProhibited) {
382+
return result;
383+
}
384+
375385
var isNativeFormField = nativeFormFields.indexOf(nTag) !== -1;
376386
var isNativeButton = ["input"].indexOf(nTag) !== -1;
377387
var isRangeWidgetRole = rangeWidgetRoles.indexOf(nRole) !== -1;
@@ -1141,11 +1151,66 @@ Plus roles extended for the Role Parity project.
11411151
// Subsequent roles added as part of the Role Parity project for ARIA 1.2.
11421152
// Tracks roles that don't specifically belong within the prior process lists.
11431153
var list4 = {
1144-
roles: ["legend", "caption"],
1145-
tags: ["legend", "caption", "figcaption"]
1154+
roles: [
1155+
"legend",
1156+
"caption",
1157+
"code",
1158+
"deletion",
1159+
"emphasis",
1160+
"generic",
1161+
"insertion",
1162+
"paragraph",
1163+
"strong",
1164+
"subscript",
1165+
"superscript"
1166+
],
1167+
tags: [
1168+
"legend",
1169+
"caption",
1170+
"figcaption",
1171+
"code",
1172+
"del",
1173+
"em",
1174+
"div",
1175+
"span",
1176+
"ins",
1177+
"p",
1178+
"strong",
1179+
"sub",
1180+
"sup"
1181+
]
11461182
};
11471183

11481184
var genericElements = ["div", "span"];
1185+
var nameProhibitedRoles = [
1186+
"caption",
1187+
"code",
1188+
"deletion",
1189+
"emphasis",
1190+
"generic",
1191+
"insertion",
1192+
"none",
1193+
"paragraph",
1194+
"presentation",
1195+
"strong",
1196+
"subscript",
1197+
"superscript"
1198+
];
1199+
var nameProhibitedElements = [
1200+
"caption",
1201+
"figcaption",
1202+
"code",
1203+
"del",
1204+
"em",
1205+
"div",
1206+
"span",
1207+
"ins",
1208+
"p",
1209+
"strong",
1210+
"sub",
1211+
"sup"
1212+
];
1213+
11491214
var nativeFormFields = ["button", "input", "select", "textarea"];
11501215
var rangeWidgetRoles = ["scrollbar", "slider", "spinbutton"];
11511216
var editWidgetRoles = ["searchbox", "textbox"];

0 commit comments

Comments
 (0)