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 1cbb48e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
9 changes: 7 additions & 2 deletions lib/custom_a11y_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var customRules = {
'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'
'helpUrl': 'https://dequeuniversity.com/rules/axe/3.2/skip-link'
}
},
{
Expand Down Expand Up @@ -116,7 +116,8 @@ var customRules = {
'fail': 'all <nav> elements MUST have aria-label or aria-labelledby attribute'
}
},
evaluate: function(node, options) {
evaluate: function(node, option) {
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 1cbb48e

Please sign in to comment.