Skip to content

Commit b1a9c36

Browse files
author
Cameron Cundiff
committed
Prevent page scroll, log results to console
- Color contrast checks normally will scroll the viewport. This is not acceptable in a dev or staging environment. - Logging results to console gives developers and designers more visibility into issues.
1 parent 712bb8b commit b1a9c36

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"url": "https://github.com/accesslint/monitor/issues"
1919
},
2020
"devDependencies": {
21-
"axe-core": "~1.1.0",
21+
"axe-core": "~1.1.1",
2222
"babel-core": "^6.2.1",
2323
"babel-loader": "^6.2.0",
2424
"babel-preset-es2015": "^6.1.18",

src/auditor.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ import { axe } from "axe-core/axe.min.js";
22
import report from "./reporter";
33

44
export default function () {
5-
window.axe.a11yCheck(document, {}, (results) => {
5+
window.axe.configure({
6+
checks: [{
7+
id: "color-contrast",
8+
options: { noScroll: true }
9+
}]
10+
});
11+
12+
window.axe.a11yCheck(document, (results) => {
613
report(results);
714
});
815
}

src/reporter.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default function (message) {
1212
nodes: violation.nodes.map(function(n) {
1313
return {
1414
target: n.target,
15+
html: n.html,
1516
impact: n.impact
1617
};
1718
}),
@@ -31,4 +32,6 @@ export default function (message) {
3132
}
3233
}, function() {});
3334
}
35+
36+
console.log("AccessLint warnings: ", violations);
3437
}

0 commit comments

Comments
 (0)