Skip to content

Commit

Permalink
a11y: if already running dont log error to server
Browse files Browse the repository at this point in the history
  • Loading branch information
mimecuvalo committed Mar 7, 2023
1 parent c4e89dd commit a036db7
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions components/internal/A11y.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ export default function A11y() {

function runAudit() {
console.log('[a11y]: running accessibility audit...');
axe.run(document, {}, (err, results) => {
if (err) throw err;
console.log('[a11y]:', results);
setErrorCount(results.violations.length);
setResults(results);
});
try {
axe.run(document, {}, (err, results) => {
if (err) throw err;
console.log('[a11y]:', results);
setErrorCount(results.violations.length);
setResults(results);
});
} catch (ex) {
console.error(ex);
}
}

function renderViolationByType(typeFilter: string) {
Expand Down

0 comments on commit a036db7

Please sign in to comment.