OAA WIDGET_1: Check aria properties and states for valid roles and properties
Details
- Check aria properties and states to make sure they are associated with a valid role.
- A role value of null indicates no role attribute is present in (FF,Opera, Safari, Chrome).
- ’’ value indicates the role is set to an empty string for all browsers except IE, which also returns ’’.
- If no role attribute is present neither of these values allow for unsupported state to be tested.
Rulesets
- WCAG 2.0 Requirement 4.1.2 Name, Role, Value
- Status: Accepted
- Severity: Violation
- Priority: Priority 1
- IITAA 1.0 13.1 Ensure that scripted functions are usable with assistive technologies.
- Type:
- Severity: Violation
- Priority: Priority 1
- Status: Accepted
Markup References
- ARIA 1.0: [aria-activedescendant]
- ARIA 1.0: [aria-atomic]
- ARIA 1.0: [aria-autocomplete]
- ARIA 1.0: [aria-busy]
- ARIA 1.0: [aria-checked]
- ARIA 1.0: [aria-controls]
- ARIA 1.0: [aria-describedby]
- ARIA 1.0: [aria-disabled]
- ARIA 1.0: [aria-dropeffect]
- ARIA 1.0: [aria-expanded]
- ARIA 1.0: [aria-flowto]
- ARIA 1.0: [aria-grabbed]
- ARIA 1.0: [aria-haspopup]
- ARIA 1.0: [aria-hidden]
- ARIA 1.0: [aria-invalid]
- ARIA 1.0: [aria-label]
- ARIA 1.0: [aria-labelledby]
- ARIA 1.0: [aria-level]
- ARIA 1.0: [aria-live]
- ARIA 1.0: [aria-multiline]
- ARIA 1.0: [aria-multiselectable]
- ARIA 1.0: [aria-orientation]
- ARIA 1.0: [aria-owns]
- ARIA 1.0: [aria-posinset]
- ARIA 1.0: [aria-pressed]
- ARIA 1.0: [aria-readonly]
- ARIA 1.0: [aria-relevant]
- ARIA 1.0: [aria-required]
- ARIA 1.0: [aria-selected]
- ARIA 1.0: [aria-setsize]
- ARIA 1.0: [aria-sort]
- ARIA 1.0: [aria-valuemax]
- ARIA 1.0: [aria-valuemin]
- ARIA 1.0: [aria-valuenow]
- ARIA 1.0: [aria-valuetext]
- ARIA 1.0: [role="alert"]
- ARIA 1.0: [role="alertdialog"]
- ARIA 1.0: [role="application"]
- ARIA 1.0: [role="article"]
- ARIA 1.0: [role="banner"]
- ARIA 1.0: [role="button"]
- ARIA 1.0: [role="checkbox"]
- ARIA 1.0: [role="columnheader"]
- ARIA 1.0: [role="combobox"]
- ARIA 1.0: [role="complementary"]
- ARIA 1.0: [role="contentinfo"]
- ARIA 1.0: [role="definition"]
- ARIA 1.0: [role="dialog"]
- ARIA 1.0: [role="directory"]
- ARIA 1.0: [role="document"]
- ARIA 1.0: [role="form"]
- ARIA 1.0: [role="grid"]
- ARIA 1.0: [role="gridcell"]
- ARIA 1.0: [role="group"]
- ARIA 1.0: [role="heading"]
- ARIA 1.0: [role="img"]
- ARIA 1.0: [role="link"]
- ARIA 1.0: [role="list"]
- ARIA 1.0: [role="listbox"]
- ARIA 1.0: [role="listitem"]
- ARIA 1.0: [role="log"]
- ARIA 1.0: [role="main"]
- ARIA 1.0: [role="marquee"]
- ARIA 1.0: [role="math"]
- ARIA 1.0: [role="menu"]
- ARIA 1.0: [role="menubar"]
- ARIA 1.0: [role="menuitem"]
- ARIA 1.0: [role="menuitemcheckbox"]
- ARIA 1.0: [role="menuitemradio"]
- ARIA 1.0: [role="navigation"]
- ARIA 1.0: [role="note"]
- ARIA 1.0: [role="option"]
- ARIA 1.0: [role="presentation"]
- ARIA 1.0: [role="progressbar"]
- ARIA 1.0: [role="radiogroup"]
- ARIA 1.0: [role="region"]
- ARIA 1.0: [role="row"]
- ARIA 1.0: [role="rowgroup"]
- ARIA 1.0: [role="rowheader"]
- ARIA 1.0: [role="scrollbar"]
- ARIA 1.0: [role="search"]
- ARIA 1.0: [role="separator"]
- ARIA 1.0: [role="slider"]
- ARIA 1.0: [role="spinbutton"]
- ARIA 1.0: [role="status"]
- ARIA 1.0: [role="tab"]
- ARIA 1.0: [role="tablist"]
- ARIA 1.0: [role="tabpanel"]
- ARIA 1.0: [role="textbox"]
- ARIA 1.0: [role="timer"]
- ARIA 1.0: [role="toolbar"]
- ARIA 1.0: [role="tooltip"]
- ARIA 1.0: [role="tree"]
- ARIA 1.0: [role="treegrid"]
- ARIA 1.0: [role="treeitem"]
Validation Code
Message
ARIA attribute %1$S is cannot be used with role=%2$S.
Dependencies
None
Context
.containsAriaAttr
Parameters
None
Code
function (ruleContext) {
var passed = true;
var attrNameArr = new Array();
var designPatterns = OpenAjax.a11y.aria.designPatterns;
//Get the role value
var role = ruleContext.getAttribute("role");
// - a role value of null indicates no role attribute is present in (FF,Opera, Safari, Chrome).
// - '' value indicates the role is set to an empty string for all browsers except
// IE which also returns '' if no role attribute is present
// neither of these values allow for unsupported state to be tested
// Make sure the role value is consistent with IE as you don't want to push a null on the stack
if (role==null)
role='';
// If there is a valid role check to see that the states are supported
if ((role != '') && designPatterns[role]) {
for (var a = 0; a < ruleContext.attributes.length; a++) {
if (OpenAjax.a11y.util.isDefinedAriaAttributeAtIndex(ruleContext, a)) {
var attrName = ruleContext.attributes[a].name;
var found = OpenAjax.a11y.xbrowser.indexOf(OpenAjax.a11y.aria.globalProperties, attrName) >= 0;
if (!found && designPatterns[role].reqProps != null) {
found = OpenAjax.a11y.xbrowser.indexOf(designPatterns[role].reqProps, attrName) >= 0;
}
if (!found && designPatterns[role].props != null) {
found = OpenAjax.a11y.xbrowser.indexOf(designPatterns[role].props, attrName) >= 0;
}
if (!found) attrNameArr.push(attrName);
}
}
}
var retMsg = new Array();
retMsg.push (attrNameArr.toString());
retMsg.push (role);
var passed = attrNameArr.length == 0;
return new ValidationResult(passed, [ruleContext], attrNameArr, '', retMsg);
}
>