Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcy Sutton committed Jun 14, 2017
2 parents 08a91bc + 288fc9d commit b254976
Show file tree
Hide file tree
Showing 53 changed files with 1,324 additions and 267 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,15 @@ v2.2.2:
v2.2.3:
date: 2017-06-01
changes:
- Removed the disable property from link-in-text-block
- Removed the disable property from link-in-text-block
v2.3.0:
date: 2017-06-14
changes:
- Overhaul of selectors API
- New experimental rule for hidden content
- New rule for aria-hidden="true" on the body
- Color-contrast rule impact is now serious
- Color-contrast fixes for implicit labels and TR elements
- Color-contrast puts 1:1 ratio elements into Needs Review/incomplete
- List category mappings in docs
- Update axe.source to work with Firefox webdriver
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The [aXe API](doc/API.md) package consists of:

## Localization

Axe can be build using your local language. To do so, a localization file must be added to the `./locales` directory. This file must have be named in the following manner: `<langcode>.json`. To build aXe using this locale, instead of the default, run aXe with the `--lang` flag, like so:
Axe can be built using your local language. To do so, a localization file must be added to the `./locales` directory. This file must have be named in the following manner: `<langcode>.json`. To build aXe using this locale, instead of the default, run aXe with the `--lang` flag, like so:

`grunt build --lang=nl`

Expand Down
2 changes: 1 addition & 1 deletion axe.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for axe-core 2.2.3
// Type definitions for axe-core 2.3.0
// Project: https://github.com/dequelabs/axe-core
// Definitions by: Marcy Sutton <https://github.com/marcysutton>

Expand Down
43 changes: 37 additions & 6 deletions doc/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,30 @@ Returns a list of all rules with their ID and description

The current set of tags supported are listed in the following table:

| Tag Name | Accessibility Standard |
|--------------------|:-------------------------------------:|
| `wcag2a` | WCAG 2.0 Level A |
| `wcag2aa` | WCAG 2.0 Level AA |
| `section508` | Section 508 |
| `best-practice` | Best practices endorsed by Deque |
| Tag Name | Accessibility Standard/Purpose |
|--------------------|:-------------------------------------------:|
| `wcag2a` | WCAG 2.0 Level A |
| `wcag2aa` | WCAG 2.0 Level AA |
| `section508` | Section 508 |
| `best-practice` | Best practices endorsed by Deque |
| `experimental` | Cutting-edge techniques |
| `cat` | Category mappings used by Deque (see below) |

| Category name |
|-------------------------------|
| `cat.aria` |
| `cat.color` |
| `cat.forms` |
| `cat.keyboard` |
| `cat.language` |
| `cat.name-role-value` |
| `cat.parsing` |
| `cat.semantics` |
| `cat.sensory-and-visual-cues` |
| `cat.structure` |
| `cat.tables` |
| `cat.text-alternatives` |
| `cat.time-and-media` |


#### Example 1
Expand Down Expand Up @@ -300,6 +318,19 @@ The options parameter is flexible way to configure how `axe.run` operates. The d
* Run all rules defined in the system, except for the list of rules specified
* Run a specific set of rules provided as a list of rule ids

Additionally, there are a number or properties that allow configuration of different options:

| Property | Default | Description |
|-----------------|:-------:|:----------------------------:|
| `runOnly` | n/a | Limit which rules are executed, based on names or tags
| `rules` | n/a | Allow customizing a rule's properties (including { enable: false })
| `reporter` | `v1` | Which reporter to use (see [Configutration](#api-name-axeconfigure))
| `xpath` | `false` | Return xpath selectors for elements
| `absolutePaths` | `false` | Use absolute paths when creating element selectors
| `iframes` | `true` | Tell axe to run inside iframes
| `elementRef` | `false` | Return element references in addition to the target


###### Options Parameter Examples

1. Run only Rules for an accessibility standard
Expand Down
2 changes: 2 additions & 0 deletions doc/rule-descriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
| accesskeys | Ensures every accesskey attribute value is unique | wcag2a, wcag211, cat.keyboard | true |
| area-alt | Ensures &lt;area&gt; elements of image maps have alternate text | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a | true |
| aria-allowed-attr | Ensures ARIA attributes are allowed for an element&apos;s role | cat.aria, wcag2a, wcag411, wcag412 | true |
| aria-hidden-body | Ensures aria-hidden is not present on the document body. | cat.aria, wcag2a, wcag412 | true |
| aria-required-attr | Ensures elements with ARIA roles have all required ARIA attributes | cat.aria, wcag2a, wcag411, wcag412 | true |
| aria-required-children | Ensures elements with an ARIA role that require child roles contain them | cat.aria, wcag2a, wcag131 | true |
| aria-required-parent | Ensures elements with an ARIA role that require parent roles are contained by them | cat.aria, wcag2a, wcag131 | true |
Expand All @@ -23,6 +24,7 @@
| frame-title-unique | Ensures &lt;iframe&gt; and &lt;frame&gt; elements contain a unique title attribute | cat.text-alternatives, best-practice | true |
| frame-title | Ensures &lt;iframe&gt; and &lt;frame&gt; elements contain a non-empty title attribute | cat.text-alternatives, wcag2a, wcag241, section508, section508.22.i | true |
| heading-order | Ensures the order of headings is semantically correct | cat.semantics, best-practice | false |
| hidden-content | Informs users about hidden content. | experimental, review-item | false |
| href-no-hash | Ensures that href values are valid link references to promote only using anchors as links | cat.semantics, best-practice | false |
| html-has-lang | Ensures every HTML document has a lang attribute | cat.language, wcag2a, wcag311 | true |
| html-lang-valid | Ensures the lang attribute of the &lt;html&gt; element has a valid value | cat.language, wcag2a, wcag311 | true |
Expand Down
1 change: 1 addition & 0 deletions lib/checks/aria/aria-hidden-body.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return node.getAttribute('aria-hidden') !== 'true';
11 changes: 11 additions & 0 deletions lib/checks/aria/aria-hidden-body.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "aria-hidden-body",
"evaluate": "aria-hidden-body.js",
"metadata": {
"impact": "critical",
"messages": {
"pass": "No aria-hidden attribute is present on document body",
"fail": "aria-hidden=true should not be present on the document body"
}
}
}
10 changes: 8 additions & 2 deletions lib/checks/color/color-contrast.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ var missing;
if (bgColor === null) {
missing = axe.commons.color.incompleteData.get('bgColor');
}

let equalRatio = false;
if (truncatedResult === 1) {
equalRatio = true;
missing = axe.commons.color.incompleteData.set('bgColor', 'equalRatio');
}
// need both independently in case both are missing
var data = {
fgColor: fgColor ? fgColor.toHexString() : undefined,
Expand All @@ -35,12 +41,12 @@ var data = {

this.data(data);

if (!cr.isValid) {
if (!cr.isValid || equalRatio) {
this.relatedNodes(bgNodes);
}

//We don't know, so we'll put it into Can't Tell
if (fgColor === null || bgColor === null) {
if (fgColor === null || bgColor === null || equalRatio) {
missing = null;
axe.commons.color.incompleteData.clear();
return undefined;
Expand Down
4 changes: 3 additions & 1 deletion lib/checks/color/color-contrast.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "color-contrast",
"evaluate": "color-contrast.js",
"metadata": {
"impact": "critical",
"impact": "serious",
"messages": {
"pass": "Element has sufficient color contrast of {{=it.data.contrastRatio}}",
"fail": "Element has insufficient color contrast of {{=it.data.contrastRatio}} (foreground color: {{=it.data.fgColor}}, background color: {{=it.data.bgColor}}, font size: {{=it.data.fontSize}}, font weight: {{=it.data.fontWeight}})",
Expand All @@ -12,6 +12,8 @@
"imgNode": "Element's background color could not be determined because element contains an image node",
"bgOverlap": "Element's background color could not be determined because it is overlapped by another element",
"fgAlpha" : "Element's foreground color could not be determined because of alpha transparency",
"elmPartiallyObscured": "Element's background color could not be determined because it's partially obscured by another element",
"equalRatio": "Element has a 1:1 contrast ratio with the background",
"default": "Unable to determine contrast ratio"
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/checks/navigation/href-no-hash.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"impact": "moderate",
"messages": {
"pass": "Anchor does not have a href quals #",
"fail": "Anchor has a href quals #"
"pass": "Anchor does not have an href value of #",
"fail": "Anchor has an href value of #"
}
}
}
15 changes: 15 additions & 0 deletions lib/checks/visibility/hidden-content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let styles = window.getComputedStyle(node);

if (axe.commons.dom.hasContent(node)) {
if (styles.getPropertyValue('display') === 'none') {
return undefined;
} else if (styles.getPropertyValue('visibility') === 'hidden') {
if (node.parentNode) {
var parentStyle = window.getComputedStyle(node.parentNode);
}
if (!parentStyle || parentStyle.getPropertyValue('visibility') !== 'hidden') {
return undefined;
}
}
}
return true;
12 changes: 12 additions & 0 deletions lib/checks/visibility/hidden-content.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"id": "hidden-content",
"evaluate": "hidden-content.js",
"metadata": {
"impact": "minor",
"messages": {
"pass": "All content on the page has been analyzed.",
"fail": "There were problems analyzing the content on this page.",
"undefined": "There is hidden content on the page that was not analyzed. You will need to trigger the display of this content in order to analyze it."
}
}
}
Loading

0 comments on commit b254976

Please sign in to comment.