OAA WIDGET_2: ARIA attributes have valid values

Details

  • For each ARIA attribute, check that their values are valid.

Rulesets

WCAG 2.0 Requirement 4.1.1 Parsing Content
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

Validation Code

Message

attribute %1$S must use a predetermined value %2$S.

Dependencies

None

Context

.containsAriaAttr

Parameters

None

Code


   function (ruleContext) {
      var attrNameArr = new Array();
      var dataTypeArr = new Array();

      // for each aria attr check for nonexistant IDs
      for(var i=0; i< ruleContext.attributes.length; i++ ) {
         var attrName = ruleContext.attributes[i].name;
         if (OpenAjax.a11y.util.isDefinedAriaAttribute(ruleContext, attrName)) {
            var dataTypes = OpenAjax.a11y.aria.propertyDataTypes[attrName];
            if (dataTypes && dataTypes.values) {
               var nodeValue = ruleContext.attributes[i].nodeValue.normalizeSpacing();
               if (OpenAjax.a11y.xbrowser.indexOf(dataTypes.values, nodeValue) == -1) {
                  if (OpenAjax.a11y.xbrowser.indexOf(dataTypes.values, 'undefined') != -1 && nodeValue.length == 0) {
                     //translate 'undefined' to mean ''
                  } else {
                     attrNameArr.push(attrName);
                     dataTypeArr.push(dataTypes.values.toString());
                  }
               }
            }
         }
      }
      var retMsg = new Array();
      retMsg.push (attrNameArr.toString());
      retMsg.push (dataTypeArr.toString());

      var passed = attrNameArr.length == 0;
      return new ValidationResult(passed, [ruleContext], attrNameArr, '', retMsg);                   
   }