Skip to content

Commit

Permalink
Merge branch 'develop' into deprecated-duplicate-id
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Mar 29, 2023
2 parents 4794898 + 4b67a9f commit a7bcb39
Show file tree
Hide file tree
Showing 15 changed files with 493 additions and 91 deletions.
83 changes: 77 additions & 6 deletions axe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,13 @@ declare namespace axe {
help: string;
};
}
interface CheckMessages {
pass: string | { [key: string]: string };
fail: string | { [key: string]: string };
incomplete: string | { [key: string]: string };
}
interface CheckLocale {
[key: string]: {
pass: string | { [key: string]: string };
fail: string | { [key: string]: string };
incomplete: string | { [key: string]: string };
};
[key: string]: CheckMessages;
}
interface Locale {
lang?: string;
Expand Down Expand Up @@ -237,7 +238,7 @@ declare namespace axe {
}
interface Spec {
branding?: string | Branding;
reporter?: ReporterVersion;
reporter?: ReporterVersion | string | AxeReporter;
checks?: Check[];
rules?: Rule[];
standards?: Standards;
Expand All @@ -263,6 +264,10 @@ declare namespace axe {
options?: any;
matches?: string;
enabled?: boolean;
metadata?: {
impact?: ImpactValue;
messages?: CheckMessages;
};
}
interface Rule {
id: string;
Expand All @@ -277,6 +282,7 @@ declare namespace axe {
tags?: string[];
matches?: string;
reviewOnFail?: boolean;
metadata?: Omit<RuleMetadata, 'ruleId'>;
}
interface AxePlugin {
id: string;
Expand Down Expand Up @@ -319,14 +325,50 @@ declare namespace axe {
frameSelector: CrossTreeSelector;
frameContext: FrameContextObject;
}

interface RawNodeResult<T extends 'passed' | 'failed' | 'incomplete'> {
any: CheckResult[];
all: CheckResult[];
none: CheckResult[];
impact: ImpactValue | null;
result: T;
}

interface RawResult extends Omit<Result, 'nodes'> {
inapplicable: [];
passes: RawNodeResult<'passed'>[];
incomplete: RawNodeResult<'incomplete'>[];
violations: RawNodeResult<'failed'>[];
pageLevel: boolean;
result: 'failed' | 'passed' | 'incomplete' | 'inapplicable';
}

type AxeReporter<T = unknown> = (
rawResults: RawResult[],
option: RunOptions,
callback: (report: T) => void
) => void;

interface VirtualNode {
actualNode?: Node;
shadowId?: string;
children?: VirtualNode[];
parent?: VirtualNode;
attr(attr: string): string | null;
hasAttr(attr: string): boolean;
props: { [key: string]: unknown };
}

interface Utils {
getFrameContexts: (
context?: ElementContext,
options?: RunOptions
) => FrameContext[];
shadowSelect: (selector: CrossTreeSelector) => Element | null;
shadowSelectAll: (selector: CrossTreeSelector) => Element[];
getStandards(): Required<Standards>;
}

interface EnvironmentData {
testEngine: TestEngine;
testRunner: TestRunner;
Expand Down Expand Up @@ -436,6 +478,35 @@ declare namespace axe {
*/
function frameMessenger(frameMessenger: FrameMessenger): void;

/**
* Setup axe-core so axe.common functions can work properly.
*/
function setup(node?: Element | Document): VirtualNode;

/**
* Clean up axe-core tree and caches. `axe.run` will call this function at the end of the run so there's no need to call it yourself afterwards.
*/
function teardown(): void;

/**
* Check if a reporter is registered
*/
function hasReporter(reporterName: string): boolean;

/**
* Get a reporter based the name it is registered with
*/
function getReporter<T>(reporterName: string): AxeReporter<T>;

/**
* Register a new reporter, optionally setting it as the default
*/
function addReporter<T>(
reporterName: string,
reporter: AxeReporter<T>,
isDefault?: boolean
): void;

// axe.frameMessenger
type FrameMessenger = {
open: (topicHandler: TopicHandler) => Close | void;
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/puppeteer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},
"devDependencies": {
"axe-core": "^4.6.2",
"puppeteer": "^19.7.2"
"puppeteer": "19.8.0"
}
}
14 changes: 7 additions & 7 deletions doc/rule-descriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
| [aria-tooltip-name](https://dequeuniversity.com/rules/axe/4.6/aria-tooltip-name?application=RuleDescription) | Ensures every ARIA tooltip node has an accessible name | Serious | cat.aria, wcag2a, wcag412 | failure, needs&nbsp;review | |
| [aria-valid-attr-value](https://dequeuniversity.com/rules/axe/4.6/aria-valid-attr-value?application=RuleDescription) | Ensures all ARIA attributes have valid values | Serious, Critical | cat.aria, wcag2a, wcag412 | failure, needs&nbsp;review | [6a7281](https://act-rules.github.io/rules/6a7281) |
| [aria-valid-attr](https://dequeuniversity.com/rules/axe/4.6/aria-valid-attr?application=RuleDescription) | Ensures attributes that begin with aria- are valid ARIA attributes | Critical | cat.aria, wcag2a, wcag412 | failure | [5f99a7](https://act-rules.github.io/rules/5f99a7) |
| [audio-caption](https://dequeuniversity.com/rules/axe/4.6/audio-caption?application=RuleDescription) | Ensures &lt;audio&gt; elements have captions | Critical | cat.time-and-media, wcag2a, wcag121, section508, section508.22.a | needs&nbsp;review | [2eb176](https://act-rules.github.io/rules/2eb176), [afb423](https://act-rules.github.io/rules/afb423) |
| [blink](https://dequeuniversity.com/rules/axe/4.6/blink?application=RuleDescription) | Ensures &lt;blink&gt; elements are not used | Serious | cat.time-and-media, wcag2a, wcag222, section508, section508.22.j | failure | |
| [button-name](https://dequeuniversity.com/rules/axe/4.6/button-name?application=RuleDescription) | Ensures buttons have discernible text | Critical | cat.name-role-value, wcag2a, wcag412, section508, section508.22.a, ACT | failure, needs&nbsp;review | [97a4e1](https://act-rules.github.io/rules/97a4e1), [m6b1q3](https://act-rules.github.io/rules/m6b1q3) |
| [bypass](https://dequeuniversity.com/rules/axe/4.6/bypass?application=RuleDescription) | Ensures each page has at least one mechanism for a user to bypass navigation and jump straight to the content | Serious | cat.keyboard, wcag2a, wcag241, section508, section508.22.o | needs&nbsp;review | [cf77f2](https://act-rules.github.io/rules/cf77f2), [047fe0](https://act-rules.github.io/rules/047fe0), [b40fd1](https://act-rules.github.io/rules/b40fd1), [3e12e1](https://act-rules.github.io/rules/3e12e1), [ye5d6e](https://act-rules.github.io/rules/ye5d6e) |
Expand Down Expand Up @@ -61,7 +60,7 @@
| [no-autoplay-audio](https://dequeuniversity.com/rules/axe/4.6/no-autoplay-audio?application=RuleDescription) | Ensures &lt;video&gt; or &lt;audio&gt; elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio | Moderate | cat.time-and-media, wcag2a, wcag142, ACT | needs&nbsp;review | [80f0bf](https://act-rules.github.io/rules/80f0bf) |
| [object-alt](https://dequeuniversity.com/rules/axe/4.6/object-alt?application=RuleDescription) | Ensures &lt;object&gt; elements have alternate text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a | failure, needs&nbsp;review | [8fc3b6](https://act-rules.github.io/rules/8fc3b6) |
| [role-img-alt](https://dequeuniversity.com/rules/axe/4.6/role-img-alt?application=RuleDescription) | Ensures [role=&apos;img&apos;] elements have alternate text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, ACT | failure, needs&nbsp;review | [23a2a8](https://act-rules.github.io/rules/23a2a8) |
| [scrollable-region-focusable](https://dequeuniversity.com/rules/axe/4.6/scrollable-region-focusable?application=RuleDescription) | Ensure elements that have scrollable content are accessible by keyboard | Moderate | cat.keyboard, wcag2a, wcag211 | failure | [0ssw9k](https://act-rules.github.io/rules/0ssw9k) |
| [scrollable-region-focusable](https://dequeuniversity.com/rules/axe/4.6/scrollable-region-focusable?application=RuleDescription) | Ensure elements that have scrollable content are accessible by keyboard | Serious | cat.keyboard, wcag2a, wcag211 | failure | [0ssw9k](https://act-rules.github.io/rules/0ssw9k) |
| [select-name](https://dequeuniversity.com/rules/axe/4.6/select-name?application=RuleDescription) | Ensures select element has an accessible name | Minor, Critical | cat.forms, wcag2a, wcag412, section508, section508.22.n, ACT | failure, needs&nbsp;review | [e086e5](https://act-rules.github.io/rules/e086e5) |
| [server-side-image-map](https://dequeuniversity.com/rules/axe/4.6/server-side-image-map?application=RuleDescription) | Ensures that server-side image maps are not used | Minor | cat.text-alternatives, wcag2a, wcag211, section508, section508.22.f | needs&nbsp;review | |
| [svg-img-alt](https://dequeuniversity.com/rules/axe/4.6/svg-img-alt?application=RuleDescription) | Ensures &lt;svg&gt; elements with an img, graphics-document or graphics-symbol role have an accessible text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, ACT | failure, needs&nbsp;review | [7d6734](https://act-rules.github.io/rules/7d6734) |
Expand Down Expand Up @@ -148,8 +147,9 @@ Rules we are still testing and developing. They are disabled by default in axe-c

Deprecated rules are disabled by default and will be removed in the next major release.

| Rule ID | Description | Impact | Tags | Issue Type | ACT Rules |
| :----------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------- | :------ | :------------------------------------------------ | :------------------------- | :------------------------------------------------- |
| [aria-roledescription](https://dequeuniversity.com/rules/axe/4.6/aria-roledescription?application=RuleDescription) | Ensure aria-roledescription is only used on elements with an implicit or explicit role | Serious | cat.aria, wcag2a, wcag412, deprecated | failure, needs&nbsp;review | |
| [duplicate-id-active](https://dequeuniversity.com/rules/axe/4.6/duplicate-id-active?application=RuleDescription) | Ensures every id attribute value of active elements is unique | Serious | cat.parsing, wcag2a-obsolete, wcag411, deprecated | failure | [3ea0c8](https://act-rules.github.io/rules/3ea0c8) |
| [duplicate-id](https://dequeuniversity.com/rules/axe/4.6/duplicate-id?application=RuleDescription) | Ensures every id attribute value is unique | Minor | cat.parsing, wcag2a-obsolete, wcag411, deprecated | failure | [3ea0c8](https://act-rules.github.io/rules/3ea0c8) |
| Rule ID | Description | Impact | Tags | Issue Type | ACT Rules |
| :----------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------- | :------- | :--------------------------------------------------------------------------- | :------------------------- | :----------------------------------------------------------------------------------------------------- |
| [aria-roledescription](https://dequeuniversity.com/rules/axe/4.6/aria-roledescription?application=RuleDescription) | Ensure aria-roledescription is only used on elements with an implicit or explicit role | Serious | cat.aria, wcag2a, wcag412, deprecated | failure, needs&nbsp;review | |
| [audio-caption](https://dequeuniversity.com/rules/axe/4.6/audio-caption?application=RuleDescription) | Ensures &lt;audio&gt; elements have captions | Critical | cat.time-and-media, wcag2a, wcag121, section508, section508.22.a, deprecated | needs&nbsp;review | [2eb176](https://act-rules.github.io/rules/2eb176), [afb423](https://act-rules.github.io/rules/afb423) |
| [duplicate-id-active](https://dequeuniversity.com/rules/axe/4.6/duplicate-id-active?application=RuleDescription) | Ensures every id attribute value of active elements is unique | Serious | cat.parsing, wcag2a-obsolete, wcag411, deprecated | failure | [3ea0c8](https://act-rules.github.io/rules/3ea0c8) |
| [duplicate-id](https://dequeuniversity.com/rules/axe/4.6/duplicate-id?application=RuleDescription) | Ensures every id attribute value is unique | Minor | cat.parsing, wcag2a-obsolete, wcag411, deprecated | failure | [3ea0c8](https://act-rules.github.io/rules/3ea0c8) |
Loading

0 comments on commit a7bcb39

Please sign in to comment.