Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Bump axe-core version
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Youngstrom committed Mar 19, 2019
1 parent fb4104f commit 3d5e8f3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
11 changes: 8 additions & 3 deletions lib/custom_a11y_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ var customRules = {
'any': ['skip-link'],
'none': [],
'metadata': {
'description': 'Ensures the first link on the page is a skip link',
'help': 'The page should have a skip link as its first link',
'helpUrl': 'https://dequeuniversity.com/rules/axe/1.1/skip-link'
'description': 'Ensures that all skip links have a valid target',
'help': 'All skip links should have a valid target, allowing users to skip the navigation',
'helpUrl': 'https://dequeuniversity.com/rules/axe/3.2/skip-link'
}
},
{
Expand Down Expand Up @@ -117,6 +117,7 @@ var customRules = {
}
},
evaluate: function(node, options) {
axe._tree = axe.utils.getFlattenedTree(node);
return axe.commons.aria.label(node) !== null;
}
},
Expand All @@ -132,6 +133,7 @@ var customRules = {
}
},
evaluate: function(node, options) {
axe._tree = axe.utils.getFlattenedTree(node);
var label = axe.commons.aria.label(node) || '',
words = label.toLowerCase().split(' ');
return words.indexOf('nav') < 0 && words.indexOf('navigation') < 0;
Expand Down Expand Up @@ -170,6 +172,9 @@ var customRules = {
rel = node.getAttribute('rel') || '';
if (href.startsWith('#') && href.length > 1 && rel !== 'leanModal') {
linkTarget = document.querySelector(href);
if (!linkTarget) {
return false;
}
return axe.commons.dom.isFocusable(linkTarget);
} else {
return true;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edx-custom-a11y-rules",
"version": "1.0.5",
"version": "1.0.6",
"description": "Custom rules for accessibility testing with aXe Core",
"main": "",
"scripts": {
Expand All @@ -23,7 +23,7 @@
},
"homepage": "https://github.com/edx/edx-custom-a11y-rules#readme",
"devDependencies": {
"axe-core": "~1.1.0",
"axe-core": "~3.2.2",
"jasmine-core": "^2.3.4",
"jshint": "^2.8.0",
"karma": "^0.13.10",
Expand Down
3 changes: 1 addition & 2 deletions test/fixtures/skip-link-fail.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
{# This will fail despite the href being OK because "main-content" div isn't focusable. #}
<a href="#main-content">Skip to main content</a>
<a href="#not-a-real-element">Skip to main content</a>
<div id="main-content">Main content</div>
2 changes: 1 addition & 1 deletion test/spec/rules_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Rules Spec', function () {
axe.configure(rules);
jasmine.getFixtures().fixturesPath = '/base/';
loadFixtures('test/fixtures/' + fixture);
axe.a11yCheck(document, {}, function (r) { results = r; done(); });
axe.run(document, function (err, result) { results = result; done(); });
});

it(fixture + ', should ' + expectedResult, function () {
Expand Down

0 comments on commit 3d5e8f3

Please sign in to comment.