Accessibility Ruleset Rule and NLS Format 2.0
From MemberWiki
Accessibility Home | Issue Tracker | Rules for Ruleset 2.0 | Evaluation API 2.0 | Ruleset Format 2.0 | DOM Cache Objects | Results Object | Log Object | Rules Format 1.0
Contents |
Introduction
This document describes the requirements for the structure of OpenAjax Accessibility (OAA) version 2.0 of accessibility validation rules and rulesets and national language support (NLS). Version 2.0 is a total rewrite of ruleset to improve performance and to add a new API layer to standardize the generation of an evaluation and make available important accessibility information used in evaluating the web page. The infomration can be used with inspection and reporting tools to provide more detailed information to users and support manual evalutation of accessibility. Rulesets allow validation rules to be organized based on popular web accessibility requirements like the W3C Web Content Accessibility Guidelines and Section 508. Each OAA validation rule is associated with a requirement in a ruleset file, the primary ruleset for the OpenAjax Alliance is W3C Web Content Accessibility Guidelines 2.0. Validation rules may be applied to a specific Document Object Model (DOM). The rules are written Javascript and use a cache of the W3C DOM implementation and uses common DOM extensions to compute rendered values (i.e. getComputedStyle) and identify event handlers. Tools can trigger the evaluation of rules based on user interaction or external events. It is beyond the scope of this document to describe how or when rules are processed and applied by a given tool. The aim is to describe a way of expressing validation rules that will enable them to be readily consumable by accessibility tool venders and open-source or third-party components and applications and that these rules will be reusable among their various applications.
Changes in Version 2.0
- Use of a DOM cache to improve rule evaluation performance
- Use of a more flexible results object and messaging system
Main Features
- Define accessibility rules using Javascript functions and data structures
- Extensible, so rules can be extended and optimized for specific needs of a project
Severity of Rules
For a given accessibility requirement a rule can be assigned 1 of 4 of the following severity values.
- Violation: Failing a rule with the severity of "Violation" means the associated accessibility requirement has not been met (i.e. WCAG 2.0 Success Criteria)
- Potential Violation: Failing this rule requires some type of human inspection to determine if the the accessibility requirement has been achieved, passing this rule means that the rule does not apply to the resource
- Recommendation: Passing this rule means that you have exceeded the minimum accessibility requirement and are using a best practice for web accessibility
- Potential Recommendation: Failing this rule means that you may have exceeded the minimum accessibility requirement and using a best practice. Human inspection is needed to determine if the the accessibility enhancements has been achieved, passing this rule means that the rule does not apply to the resource
Extending Rules Beyond Accessibility Evaluation
This document focuses upon validation rules that are derived from WCAG 2.0 and, in particular, the accessibility of web content as understood by that specification, the aim is to permit these requirements to determine the codification of other types of rules. For instance, these requirements might be useful in describing rule formats for specifying privacy and security policies of corporate web sites, a company's branding strategy and legal policies via logos, templates, and page layouts and disclaimers and notices, or rules that are derived from other open standards, including other accessibility standards.
Rule Files and SVN Repository
The rules, rules sets, national language message, utility and tests suite are contained in a SVN Sourceforge for OpenAjax Accessibility Rules and Tests repository.
Organization of Rules and Rulesets
- Name Space and Caching
- Sets up A11y namespace
- Cache setting
- Rule Files
- Code for individual rules
- Rules are independent of rulesets
- A rule may not be a part of every ruleset
- Rules are loosely divided up to to logical groups related to the markup they check
- Ruleset Files
- Define the relationships between accessibility requirements and the rules
- Each rule can be associated with one accessibility requirement
- Rules sets can provide information on related links for more accessibility information
- National Language Support (NLS) Files
- Rulesets refer to IDs for messages and rule descriptive titles that can be localized to a specific language
- Each ruleset needs a file for each translation
- Utility Files
- Set of common functions used by rules for processing rules
- Functions support content processing, caching, browser abstraction, XPath and other shared resources used by the rules
- WAI-ARIA File
- A JSON object that define valid ARIA design patterns
a11y Namespace and Caching
SVN uri: [ https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/openajax_a11y.js https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/openajax_a11y.js]
This file sets up the OpenAjax namespace (OpenAjax.a11y) and provides a beta implementation of the cache.
Rules Directory
SVN uri: [ https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/rules https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/rules]
This contains the rule information and message references to the NLS message files. The rules have been divided up into several files based on logical grouping of tests:
- oaa-rules_accesskey.js
- oaa-rules_audio_video.js
- oaa-rules_data_table.js
- oaa-rules_form_and_widget.js
- oaa-rules_frame.js
- oaa-rules_image_area.js
- oaa-rules_landmark_header.js
- oaa-rules_lang.js
- oaa-rules_layout.js
- oaa-rules_links.js
- oaa-rules_scripting.js
- oaa-rules_style.js
Ruleset Directory
SVN uri: [ https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/rulesets https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/rulesets]
The following ruleset files have been defined:
- wcag20-ruleset.js for Web Content Accessibility Guidelines (WCAG) 2.0
National Language Support (NLS) File Directory
SVN uri: [ https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/nls https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/nls]
This directory contains files for language specific messages and labels for the rules and rulesets files:
- wcag20-ruleset_en-us.js - English translation of WCAG 2.0 messages
Cache Generation and Utility Scripts File Directory
SVN uri: [ https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/scripts/ https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/version-2/trunk/openajax_a11y/scripts/]
This directory contains files that are used for content processing, caching, browser abstraction, XPath and other shared resources used by the rules:
- cache_color_contrast.js
- cache_dom_element.js
- cache_dom_traversal.js
- cache_headings.js
- cache_images.js
- cache_landmarks.js
- cache_links.js
- cache_list.js
- cache_owns.js
- cache_style.js
- cache_tables.js
- cache_util.js
- progress_log.js
- ruleset_results.js
WAI ARIA Directory
SVN uri: https://openajaxallianc.svn.sourceforge.net/svnroot/openajaxallianc/accessrules/src/wai-aria/
This directory contains a JSON file that defines the allowed Accessible Rich Internet Accessibility (ARIA) design patterns:
- wai-aria-definitions.js - JSON object of allowed ARIA design patterns, used in some rules for ARIA validation
Rule Object
Rule Object Property Summary
The following table lists the proposed properties that are associated with a rule in the rule file. For each property, the table has the following headings:
| Property Name | Type | Required | Default | Description |
|---|---|---|---|---|
| id | String | Yes | a unique token that can be used to pick out a particular rule from the collection of rules | |
| lastUpdated | String | No | Date formatted string when the rule was last changed | |
| cacheDependency | String | Yes | none | Is used by processing engine to create the selected cache on demand needed for this rule |
| cacheProperties | Array | Yes | none | Identifies the properties of the cache that are important for this rule and can be used by inspection tools to filter properties for rendering to users |
| cacheFilter | Function | no | none | Filters the cache to the items in the cache relevant to this rule |
| language | String | Yes | empty | List of space separated languages that this rule applies to, if all languages the string is emtpy |
| enabled | Boolean | Yes | true | Process flag to rule engine, if true process the rule, if false do not process the rule |
| validateParams | Object | No | null | parameters specific to the validation function for this rule (see below) |
| validate | Function | Yes | function encapsulating the logic for a given rule (see below) |
Rule Object Example
// ------------------------
// Image 3: For English languages alt text should be between a minimum and maximum length
// Group image
//
// Last update: 2011-07-20
// ------------------------
{ id : 'IMAGE_3',
lastUpdated : '2011-07-11',
cacheDependency : 'images_cache',
cacheProperties : ['text_alt', 'role'],
language : "en-us en-br",
enabled : true,
validateParams : {
min_alt_text_length : {value:10, type:"integer"},
max_alt_text_length : {value:150, type:"integer"}
},
validate : function (dom_cache, rule_result) {
var MIN_TEXT_LENGTH = parseInt(this.validateParams.min_text_length.value);
var MAX_TEXT_LENGTH = parseInt(this.validateParams.max_text_length.value);
var i;
var image_elements = dom_cache.images_cache.image_elements;
var image_element = null;
var has_alt = false;
var alt_length = null;
// Check to see if valid cache reference
if (image_elements) {
var image_elements_len = image_elements.length;
for (i=0; i < image_elements_len; i++) {
image_element = image_elements[i];
has_alt = typeof image_element.text_alt == "string";
if (has_alt) {
alt_length = image_element.text_alt.length;
}
if (image_element.dom_element.role == 'presentation' &&
(has_alt && (alt_length == 0))) {
rule_result.addResult(OpenAjax.a11y.SEVERITY.NA, image_element, 'MESSAGE_PRESENTATION', []);
}
else {
if (has_alt) {
if (alt_length < MIN_TEXT_LENGTH) {
rule_result.addResult(rule_result.rule_severity, image_element, 'MESSAGE_FAIL_TO_SHORT', [alt_length. MIN_TEXT_LENGTH]);
}
else {
if (alt_length > MAX_TEXT_LENGTH) {
rule_result.addResult(rule_result.rule_severity, image_element, 'MESSAGE_FAIL_TO_LONG', [alt_length, MAX_TEXT_LENGTH]);
}
else {
rule_result.addResult(OpenAjax.a11y.SEVERITY.PASS, image_element, 'MESSAGE_PASS', [alt_length, MIN_TEXT_LENGTH, MAX_TEXT_LENGTH]);
}
}
}
else {
rule_result.addResult(rule_result.rule_severity, image_element, 'MESSAGE_FAIL_NO_ALT', []);
}
}
} // end loop
}
}
},
id Property
The id is a unique string value used as a programmatic reference to the Rule object properties and methods from a Ruleset. A Rule should only be assigned to one requirement per Ruleset.
lastUpdated Property
A date formatted string on when the rule was last updated.
cacheDependency Property
String value of the cache name needed by this rule and is used by the evaluation engine to create the cache when needed by this rule. The value is the String name of the cache property (i.e. 'images_cache', 'links_cache', 'landmarks_cache', ...) When the evaluation engine creates specialized caches it can be created all at one time or only when a rule needs it. Creating the cache all at one time is faster but may use more memory if rules that use one of the specialized caches are disabled. The way the cache is created is controlled through the evaluation API.
cacheProperties Property
Array of the properties that are associated with this rule, including DOMElement and ComputedStyle properties associated with the cache item. This can be used by inspection engines to provide rule specific views of the cache item.
CacheFilter Property
Function that filters the cache to the items in the cache relevant for this rule. For example rules related to links with the same HREF or accessible name could be filtered by this function. The filter returns an Array of filtered items.
Language Property
List of space separated languages that this rule applies to, if this rule applies to all languages the string is empty. more information on language values see: http://www.iana.org/assignments/language-subtag-registry and http://www.rfc-editor.org/rfc/bcp/bcp47.txt
enabled Property
This is a Boolean property used by the evaluation engine to determine whether a rule should be processed or not. The default value is true, but could be changed by configuration to be false. When false the rule will not be processed by the evaluation engine.
Validation Parameters Object
The logic of some validation rules will depend upon parameters that are determined by the ruleset in which the rule is placed or by the native language of the content. The group will offer suggested values for such parameters but tool developers may expose ways to overwrite the properties or values of these parameters.
The 'validateParams' property of a rule logic object serves to define such parameters. The validateParams object is a JavaScript object, the keys of which are the names of the variables (i.e. the identifiers) to be referenced in the validate function for that rule. Each identifier/key is associated with an object that contains additional information about the parameter, including the only required property, its value.
For example, the range within which the length of an alt text attribute value might fall will likely depend upon the native language of the content being validated and by the specification embodied by a given ruleset. Hence, this range could be expressed as two parameters, 'min_alt_text_length' and 'max_alt_text_length'. A rule that wishes to utilize these parameters might look as follows:
Validate Function
The rule logic for a given rule is always expressed as a JavaScript function and associated with the 'validate' method of the Rule Object. The definition of this function is as follows:
validate : function (com_cache, rule_results)
Ruleset Object
Ruleset Object Summary
Rulesets are defined as JSON objects and have the following properties:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| id | String | Yes | a unique identifier that can be used to identify a ruleset from the collection of rulesets | |
| nameCode | String | Yes | the ID of a localizable, human-readable name of or label for the ruleset | |
| descriptionCode | String | No | null | the ID of a localizable, human-readable description for the ruleset |
| rulesetUrl | String | No | null | the URL defining the specification or guidelines embodied by this ruleset |
| baseReqUrl | String | No | null | the base URL for resolving any relative URLs given as the value of the 'requirementUrl' property of rule objects |
| versionCode | String | Yes | Yes | Version number of the current ruleset |
| date | String | Yes | No | Date the ruleset was last modified |
| requirements | Array | Yes | an array of requirements objects as defined below |
Requirement Object Array
Each object in the requirements array has a set of properties to identify a rule and the severity, priority and message in relation to the requirement. This includes a 'rules' property, which is a dictional list that associates Rule Objects to the requirement using the id of the Rule Object. A Rule Object should only be associated with one requirement within a rule set. All other properties for that rule are obtained from the requirements object or from the rule logic object (the object containing the definition of the validate function). Thus, the value of a given rule property can be obtained from the following sources, in the following order:
- the rule logic object itself in which the validate function is defined
- the rule object within the requirements object (ruleset.rule) that defines properties specific to a given rule
- the requirements object in which a rule is included
Ruleset Requirement Object
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| requirementNumber | String | Yes | The identifying number, index, tag, or other distinguishing identifier within a given checklist, specification, or set of guidelines for the rule (e.g. "1.1.1" in WCAG20 or "1194.21d" of U.S. Section 508 | |
| requirementLevel | String | Yes | Localizable compliance or stringency level as taken from the original set of guidelines that corresponds to the value of a given 'requirementNumber' property | |
| requirementURL | String | No | null | A relative or absolute URL at which the rule is defined and where more information about the rule and how to satisfy it is available |
| enabled | Boolean | No | True | A boolean value indicating whether the requirement should be tested as part of the current evaluation, default value is True, but could be temporarily disabled through a testing tool |
| rules | Object List | Yes | A list of rule ids associated with the requirement. Each rule id defines an object that is used to define the severity, relative priority with the requirement and the message associated with the rule |
Ruleset Rule Object List
Rule Object ids are generated from OAA Accessibility Support web site and the values are represented as strings in the rule object. Rule Object ids are assigned from a range of numeric values with a prefix of "RUKE_NN". The Rule ids are generated by the support site so the ids can be more easily referenced to test cases, rulesets and National Langauge Support (NLS) messages for the rules.
A ruleset is a collection of rules, usually meant to embody a specific set of guidelines, a policy, or set of compliance requirements. For example, a ruleset might represent the accessibility standards defined by | WCAG20 or the by | U.S. Section 508.
Rulesets have their own unique properties (discussed in the next section) and subgroups of rules called 'requirements'. A 'requirement' object represents a colection of rules that corresponds to a specification, or checklist. For example, each of the success criteria of the W3C Web Content Accessibility Guidelines (WCAG) 2.0 would be a Requirement Object in an OAA ruleset representing WCAG 2.0.
Ruleset Rule Object
| Name | Type | Required | Values | Description |
|---|---|---|---|---|
| severityCode | String | Yes |
| One of four localizable token describing the impact to the application or content that results when failing this rule |
| priorityCode | String | Yes |
| One of three localizable token describing the priority of importance of the rule relative to the other rules in the requirement |
| statusCode | String | Yes |
| One of three localizable token describing the status of using the rule to evaluate content |
| messageCode | String | Yes | null | reference to a localizable description of the problem that is to be repaired when a rule fails |
| groupCode | String | Yes | null | reference to a group code for grouping related rules |
| enable | Boolean | No | default value is true | A boolean value indicating whether a rule should be evaluated |
Ruleset Object Example
//
// Basic info
//
id : 'WCAG_2_0', // Unique ID reference for ruleset
nameCode : 'name', // Reference to the name of requirements document in the NLS file
descriptionCode : 'description', // Reference to the description of the requirements document in the NLS file
versionCode : 'version', // Reference to the ruleset version in the NLS file
date : '2011-03-31', // Date this file was last modified
// rulesetUrl - URL of the checklist/ruleset as a whole
rulesetUrl : 'http://www.w3.org/TR/WCAG20/',
// baseReqUrl - used to resolve relative urls of requirementURLs only
baseReqUrl : ,
//
// WCAG 2.0 Success Criteria mapping of OAA Rules
//
requirements : [
.....
//
// WCAG 2.0 Success Criteria 2.4.9 Link Purpose (Link Only)
//
{
requirementNumber : '2.4.9',
requirementLevel : 'LEVEL_AAA',
requirementURL : 'http://www.w3.org/TR/WCAG20/#qr-navigation-mechanisms-link',
enabled : true,
rules : {
//
// LINK 2: Links with the same HREF should have the same accessible name text.
// Group 11: Link Rule
//
'LINK_2' : { severityCode : OpenAjax.a11y.SEVERITY.VIOLATION,
priorityCode : OpenAjax.a11y.PRIORITY.P1,
statusCode : OpenAjax.a11y.STATUS.ACCEPTED,
groupCode : OpenAjax.a11y.GROUP.LINK,
enabled : true,
},
//
// LINK 3: Links with the same accessible text should have the same HREF.
// Group 11: Link Rule
//
'LINK_3' : { severityCode : OpenAjax.a11y.SEVERITY.VIOLATION,
priorityCode : OpenAjax.a11y.PRIORITY.P1,
statusCode : OpenAjax.a11y.STATUS.ACCEPTED,
groupCode : OpenAjax.a11y.GROUP.LINK,
enabled : true,
},
} // end list of rules
}, // end success criteria 2.4.9
.....
]
severityCode
This is the importance of a rule in meeting the minimal and optimal implementation of an accessibility requirement. Violations are assigned to rules for minimum compliance and recommendations are assigned to rules that define improved or optimal accessibility.
| severityCode Values | Description |
|---|---|
| SEVERITY.VIOLATION | This rule defines a coding pattern for basic or minimum implementation of a accessibility requirement |
| SEVERITY.POTENTIAL_VIOLATION | If this rule fails it requires a human inspection to determine if code meets accessibility requirement. If the rule passes it means that it is not applicable to the current resource or passed the requirement. |
| SEVERITY.RECOMMENDATION | This rule identifies coding patterns that improve or provide optimal the implementation of an accessibility requirement |
| SEVERITY.POTENTIAL_RECOMMENDATION | If this rule fails it requires a human inspection to determine if the code exceeds an requirement. If the rule passes if means that it is not applicable to the current resource or passed the requirement. |
priorityCode
These are the advisory relative priorities for implementation of a rule requirement. If more than one rule fails for a requirement these priorities help developers understand which rules are more important in improving accessibility. The priorities to not affect the severity of the requirement, all rules must be satisfied to fully meet a requirement.
| priorityCode Values | Description |
|---|---|
| PRIORITY.P1 | Rule coding practices that are priority P1 should be satisfied before P2 and P3 rules |
| PRIORITY.P2 | Rule coding practices that are priority P2 should be satisfied before P3 rules |
| PRIORITY.P3 | Rule coding practices that are priority P3 should be satisfied after P1 and P2 requirements |
statusCode
The status code indicates whether the rule has been accepted and reviewed for general use, proposed for review or has been deprecated. Evaluation tools may want to filter rules for inclusion in a report based on the status of rules.
| statusCode Values | Description |
|---|---|
| STATUS.ACCEPTED | This rule is defines a generally accepted coding pattern for an accessibility requirement |
| STATUS.PROPOSED | This rule is under review to become a generally accepted coding pattern |
| STATUS.DEPRECATED | The coding pattern detected in this rule is no longer a general coding pattern for accessibility, there are new patterns that are better or easier to implement |
groupCode
The groupCode is dictionary value for grouping related Rule Objects. An evaluation tool could provide a way to enable and disable the execution of groups of rules. The groupCode is also a dictionary value for use in looking up messages associated with the group in the groups dictionary object in the National Language Support (NLS) file for a ruleset.
National Language Support (NLS) Object
The National Language Support (NLS) files provide a way to localize the language of all the text resources associated with the OAA rules and a ruleset.
National Language Support (NLS) Object Example
//
// OpenAjax Alliance WCAG 2.0 Ruleset National Language Support (NLS): English
//
OpenAjax.a11y.addNLSForRuleset('WCAG_2_0', 'en-us', {
name : 'WCAG 2.0',
description : 'Web Content Accessibility Guidelines v2.0',
version : 'beta',
date : '2011-05-13',
//
// Level of important of a requirement
//
levels : {
'LEVEL_A' : 'A', // Most important requirements
'LEVEL_AA' : 'AA', // Important requirements
'LEVEL_AAA' : 'AAA', // Lower importance requirements
},
//
// Severity of not meeting a requirement
//
severities : ['Pass','N/A','Violation','Potential Violation','Recommendation','Potential Recommendation'],
//
// Relative implementation priorities of complying to rule requirements
//
priorities : ['First Priority','Second Priority','Third Priority'],
//
// Status of a rule for evaluating a requirement
//
status : {
'STATUS_ACCEPTED' : 'Accepted',
'STATUS_PROPOSED' : 'Proposed',
'STATUS_DEPRECATED' : 'Deprecated',
},
//
// Types of rule references to a requirement
//
references : {
'RR_TYPE_REQUIREMENT' : 'Requirement',
'RR_TYPE_TECHNIQUE' : 'Technique',
'RR_TYPE_BEST_PRACT' : 'Best Practice',
'RR_TYPE_MANUAL' : 'Manual Check',
'RR_TYPE_OTHER' : 'Other',
},
//
// Abbreviation for the types of rule references to a requirement
//
reference_abbreviations : {
'RR_TYPE_REQUIREMENT' : 'R',
'RR_TYPE_TECHNIQUE' : 'T',
'RR_TYPE_BEST_PRACT' : 'BP',
'RR_TYPE_MANUAL' : 'MC',
'RR_TYPE_OTHER' : 'O',
},
//
// WCAG 2.0 Success Criteria (i.e. requirements) National Language Support (NLS)
//
requirements : {
//
// Requirement 1.1.1 Non-text Content
//
'1.1.1' : {
label : '1.1.1 Non-text Content',
description : 'All non-text content that is presented to the user has a text alternative that serves the equivalent purpose, except for the situations listed below.',
url : 'http://www.w3.org/TR/WCAG20/#text-equiv',
references : [
{ type: 'RR_TYPE_BEST_PRACT', title: 'Test 3', url: 'http://test3.org'},
{ type: 'RR_TYPE_MANUAL', title: 'Test 4', url: 'http://test4.org'},
{ type: 'RR_TYPE_OTHER', title: 'Test 5', url: 'http://test5.org'},
{ type: 'RR_TYPE_REQUIREMENT', title: 'Test 1', url: 'http://test1.org'},
{ type: 'RR_TYPE_TECHNIQUE', title: 'Test 2', url: 'http://test2.org'},
],
},
....
//
// OAA Rules title and mesage string National Language Support (NLS)
//
rules : {
IMAGE_1 : {
MESSAGE_PASS : 'Image 2: Image has alt attribute.' ,
MESSAGE_FAIL : 'Image 2: Alt attribute is missing or empty.' ,
MESSAGE_MANUAL : 'Image 1: Alt text should describe the purpose and/or the content of the image.' ,
MESSAGE_NA : 'Image 1: Image does not have alt attribute',
TITLE : 'Image 1: Alt text should describe the purpose of the link' ,
},
IMAGE_2 : {
MESSAGE_PASS : 'Image 2: Image has alt attribute.' ,
MESSAGE_FAIL : 'Image 2: Alt attribute is missing or empty.' ,
MESSAGE_ROLE_PRES_1 : 'Image 2: Images with role presentations do not need alt text',
MESSAGE_ROLE_PRES_2 : 'Image 2: Images with role presentations do not need alt text',
TITLE : 'Image 2: Images must have an alt attribute' ,
},
IMAGE_3 : {
TITLE : 'Image 3: For English languages alt text should be between a minimum and maximum length' ,
MESSAGE_PASS : 'Image 3: Alt text is %1 characters so it is greater or equal to the minimum length of %2 and less than or equal to %3 characters.' ,
MESSAGE_FAIL_TO_LONG : 'Image 3: Alt text is %1 characters and is longer than %2 characters, you should use the longdesc attribute to provide extended descriptions.' ,
MESSAGE_FAIL_TO_SHORT : 'Image 3: Alt text is %1 characters and shorter than %2 characters, make sure the text accurary describes the purpose and/or the content of the image.' ,
MESSAGE_FAIL_NO_ALT : 'Image 3: Missing or empty alt attribute on this image.' ,
MESSAGE_PRESENTATION : 'Image 3: Image is only used for graphical styling or positioning.' ,
},
....
Rule Test Cases
When a rule is submitted to the task force in the format given above, the contributor is also responsible for submitting a test case for that rule. The test case is an HTML document that can demonstrate that the rule, when executed, returns a passing result on those nodes that satisfy the context of the rule and the rule logic and returns a failing result for those that satisfy the rule context but fail the rule logic. Thus, nodes that do not satisfy the rule context should be ignored.
Test cases will be managed by the support OAA Accessibility Website that includes management of Test Cases for each rule. There is a web based editor for managing the test cases and assoicated rules and pass/fail ids.
As part of the test case a JSON data structure must be included to provide information on test results. This information is encoded in JSON using a rulesCoverage object that looks like the following:
Example Test Case Meta Data
<script type="text/javascript">
var OpenAjax = OpenAjax || {} ;
OpenAjax.a11y = OpenAjax.a11y || {} ;
OpenAjax.a11y.test = OpenAjax.a11y.test || {} ;
OpenAjax.a11y.test.testId = "25";
OpenAjax.a11y.test.testTitle = "Some Form Controls Violate Rules";
OpenAjax.a11y.test.testDate = "Last updated on Dec. 12, 2010, 8:51 p.m.";
OpenAjax.a11y.test.testUrl = "http://www.oaa-accessibility.org/testsuites/test/25/";
OpenAjax.a11y.test.nextUrl = "http://www.oaa-accessibility.org/testsuites/test/26/";
OpenAjax.a11y.test.ruleTestResults = [
{
ruleId: "rule_47",
ruleLabel: "Each fieldset element should contain a legend element.",
ruleFailIds: ['id6','id8'],
rulePassIds: ['id1']
},
{
ruleId: "rule_49",
ruleLabel: "Each input element with type=text | password | checkbox | radio | file and each select and textarea element should either be referenced by the for attribute of a label element via its id attribute, or have a title attribute.",
ruleFailIds: ['id9','id10'],
rulePassIds: ['id2','id3','id4','id5','id7','id11','id12']
},
{
ruleId: "rule_50",
ruleLabel: "Input element of type=[image] must have an alt or a title attribute.",
ruleFailIds: ['id13'],
rulePassIds: []
},
{
ruleId: "rule_57",
ruleLabel: "Form controls must have unique ids.",
ruleFailIds: ['id7'],
rulePassIds: ['id2','id3','id4','id5','id9','id10','id11','id12','id13']
},
]
</script>
The ruleCoverage object should be defined in the OpenAjax.a11y namespace for clarity and interoperability of tooling and is an array of objects. Each object in this array consists of three properties:
- 'ruleId': specifies the rule for which test results are being given
- 'ruleTitle': specifies a human readable title for the rule
- 'ruleFailIds': list of IDs of node that the rule should mark as failed
- 'rulePassIds': list of IDs of node that the rule should mark as passing a rule
No test harness is maintained by this group at this time for verifying the correctness of the test case or of its validity with regard to the rule(s) that it purports to test.
