add axe to create accessibility reports

This commit is contained in:
Alberto Iannaccone 2022-02-09 20:31:23 +01:00
parent a20899ff43
commit 6ac7439067
3 changed files with 32 additions and 3 deletions

View File

@ -60,6 +60,7 @@
"async-mutex": "^0.3.0", "async-mutex": "^0.3.0",
"atob": "^2.1.2", "atob": "^2.1.2",
"auth0-js": "^9.14.0", "auth0-js": "^9.14.0",
"@axe-core/react": "^4.3.2",
"btoa": "^1.2.1", "btoa": "^1.2.1",
"css-element-queries": "^1.2.0", "css-element-queries": "^1.2.0",
"dateformat": "^3.0.3", "dateformat": "^3.0.3",
@ -165,4 +166,4 @@
"version": "0.6.0" "version": "0.6.0"
} }
} }
} }

View File

@ -68,9 +68,15 @@ import { ArduinoPreferences } from './arduino-preferences';
import { SketchesServiceClientImpl } from '../common/protocol/sketches-service-client-impl'; import { SketchesServiceClientImpl } from '../common/protocol/sketches-service-client-impl';
import { SaveAsSketch } from './contributions/save-as-sketch'; import { SaveAsSketch } from './contributions/save-as-sketch';
import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution'; import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution';
import * as ReactDOM from 'react-dom';
const INIT_LIBS_AND_PACKAGES = 'initializedLibsAndPackages'; const INIT_LIBS_AND_PACKAGES = 'initializedLibsAndPackages';
declare global {
interface Window {
runAxe: () => void;
}
}
@injectable() @injectable()
export class ArduinoFrontendContribution export class ArduinoFrontendContribution
implements implements
@ -78,8 +84,7 @@ export class ArduinoFrontendContribution
TabBarToolbarContribution, TabBarToolbarContribution,
CommandContribution, CommandContribution,
MenuContribution, MenuContribution,
ColorContribution ColorContribution {
{
@inject(ILogger) @inject(ILogger)
protected logger: ILogger; protected logger: ILogger;
@ -164,6 +169,11 @@ export class ArduinoFrontendContribution
@postConstruct() @postConstruct()
protected async init(): Promise<void> { protected async init(): Promise<void> {
window.runAxe = () => {
const axe = require('@axe-core/react');
axe(React, ReactDOM);
};
const isFirstStartup = !(await this.localStorageService.getData( const isFirstStartup = !(await this.localStorageService.getData(
INIT_LIBS_AND_PACKAGES INIT_LIBS_AND_PACKAGES
)); ));

View File

@ -2,6 +2,14 @@
# yarn lockfile v1 # yarn lockfile v1
"@axe-core/react@^4.3.2":
version "4.3.2"
resolved "https://registry.yarnpkg.com/@axe-core/react/-/react-4.3.2.tgz#20d175b7bc05e12301ca76fcddeb259a4ae88dbc"
integrity sha512-LSMydcQFFZrqiIqalgywVzHs3paLV6aQHKCba2F7kYWFTpqc/OvQ71NIPkjYY+oF06DgA4ucS2MrcYGbgx8kJg==
dependencies:
axe-core "^4.3.3"
requestidlecallback "^0.3.0"
"@babel/code-frame@7.12.11": "@babel/code-frame@7.12.11":
version "7.12.11" version "7.12.11"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f"
@ -4392,6 +4400,11 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==
axe-core@^4.3.3:
version "4.4.1"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.4.1.tgz#7dbdc25989298f9ad006645cd396782443757413"
integrity sha512-gd1kmb21kwNuWr6BQz8fv6GNECPBnUasepcoLbekws23NVBLODdsClRZ+bQ8+9Uomf3Sm3+Vwn0oYG9NvwnJCw==
babel-code-frame@^6.11.0: babel-code-frame@^6.11.0:
version "6.26.0" version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
@ -12549,6 +12562,11 @@ request@^2.82.0, request@^2.86.0, request@^2.87.0, request@^2.88.0, request@^2.8
tunnel-agent "^0.6.0" tunnel-agent "^0.6.0"
uuid "^3.3.2" uuid "^3.3.2"
requestidlecallback@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/requestidlecallback/-/requestidlecallback-0.3.0.tgz#6fb74e0733f90df3faa4838f9f6a2a5f9b742ac5"
integrity sha1-b7dOBzP5DfP6pIOPn2oqX5t0KsU=
requestretry@^3.1.0: requestretry@^3.1.0:
version "3.1.0" version "3.1.0"
resolved "https://registry.yarnpkg.com/requestretry/-/requestretry-3.1.0.tgz#c8e1976bb946f14889d3604bbad56a01d191c10d" resolved "https://registry.yarnpkg.com/requestretry/-/requestretry-3.1.0.tgz#c8e1976bb946f14889d3604bbad56a01d191c10d"