Update w3 reference in the react-a11y-role rule (#847)
* Update w3 reference in the react-a11y-role rule * Update tests related to the react-a11y-role rule
This commit is contained in:
Родитель
a6754593a1
Коммит
fbdc415878
|
@ -1038,7 +1038,7 @@ We recommend you specify exact versions of lint libraries, including `tslint-mic
|
|||
</td>
|
||||
<td>
|
||||
For accessibility of your website, elements with aria roles must use a **valid**, **non-abstract** aria role.
|
||||
A reference to role definitions can be found at [WAI-ARIA roles](https://www.w3.org/TR/wai-aria/roles#role_definitions).
|
||||
A reference to role definitions can be found at [WAI-ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#role_definitions).
|
||||
<br />
|
||||
References:
|
||||
<ul>
|
||||
|
@ -1056,7 +1056,7 @@ We recommend you specify exact versions of lint libraries, including `tslint-mic
|
|||
<br />
|
||||
References:
|
||||
<ul>
|
||||
<li><a href="https://www.w3.org/TR/wai-aria/roles#role_definitions">ARIA Definition of Roles</a></li>
|
||||
<li><a href="https://www.w3.org/TR/wai-aria-1.1/#role_definitions">ARIA Definition of Roles</a></li>
|
||||
<li><a href="http://oaa-accessibility.org/wcag20/rule/90">WCAG Rule 90: Required properties and states should be defined</a></li>
|
||||
<li><a href="http://oaa-accessibility.org/wcag20/rule/91">WCAG Rule 91: Required properties and states must not be empty</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -26,13 +26,13 @@ const TAGS_WITH_ARIA_LEVEL: string[] = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|||
export function getFailureStringForNotImplicitRole(roleNamesInElement: string[], missingProps: string[]): string {
|
||||
return `Element with ARIA role(s) '${roleNamesInElement.join(', ')}' \
|
||||
are missing required attribute(s): ${missingProps.join(', ')}. \
|
||||
A reference to role definitions can be found at https://www.w3.org/TR/wai-aria/roles#role_definitions.`;
|
||||
A reference to role definitions can be found at https://www.w3.org/TR/wai-aria-1.1/#role_definitions.`;
|
||||
}
|
||||
|
||||
export function getFailureStringForImplicitRole(tagName: string, roleNamesInElement: string, missingProps: string[]): string {
|
||||
return `Tag '${tagName}' has implicit role '${roleNamesInElement}'. \
|
||||
It requires aria-* attributes: ${missingProps.join(', ')} that are missing in the element. \
|
||||
A reference to role definitions can be found at https://www.w3.org/TR/wai-aria/roles#role_definitions.`;
|
||||
A reference to role definitions can be found at https://www.w3.org/TR/wai-aria-1.1/#role_definitions.`;
|
||||
}
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
|
@ -42,7 +42,7 @@ export class Rule extends Lint.Rules.AbstractRule {
|
|||
description: 'Elements with aria roles must have all required attributes according to the role.',
|
||||
rationale: `References:
|
||||
<ul>
|
||||
<li><a href="https://www.w3.org/TR/wai-aria/roles#role_definitions">ARIA Definition of Roles</a></li>
|
||||
<li><a href="https://www.w3.org/TR/wai-aria-1.1/#role_definitions">ARIA Definition of Roles</a></li>
|
||||
<li><a href="http://oaa-accessibility.org/wcag20/rule/90">WCAG Rule 90: Required properties and states should be defined</a></li>
|
||||
<li><a href="http://oaa-accessibility.org/wcag20/rule/91">WCAG Rule 91: Required properties and states must not be empty</a></li>
|
||||
</ul>`,
|
||||
|
|
|
@ -19,7 +19,7 @@ const VALID_ROLES: string[] = Object.keys(ROLES).filter(role => ROLES[role].isAb
|
|||
|
||||
export function getFailureStringUndefinedRole(): string {
|
||||
return (
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria/roles#role_definitions, " +
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria-1.1/#role_definitions, " +
|
||||
'or simply remove this attribute'
|
||||
);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export function getFailureStringUndefinedRole(): string {
|
|||
export function getFailureStringInvalidRole(invalidRoleName: string): string {
|
||||
return `Invalid role attribute value '${invalidRoleName}', elements with ARIA roles must use a valid, \
|
||||
non-abstract ARIA role. A reference to role definitions can be found at \
|
||||
https://www.w3.org/TR/wai-aria/roles#role_definitions.`;
|
||||
https://www.w3.org/TR/wai-aria-1.1/#role_definitions.`;
|
||||
}
|
||||
|
||||
export class Rule extends Lint.Rules.AbstractRule {
|
||||
|
@ -36,7 +36,7 @@ export class Rule extends Lint.Rules.AbstractRule {
|
|||
type: 'maintainability',
|
||||
description:
|
||||
'Elements with aria roles must use a **valid**, **non-abstract** aria role. ' +
|
||||
'A reference to role definitions can be found at [WAI-ARIA roles](https://www.w3.org/TR/wai-aria/roles#role_definitions).',
|
||||
'A reference to role definitions can be found at [WAI-ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#role_definitions).',
|
||||
rationale: `References:
|
||||
<ul>
|
||||
<li><a href="http://oaa-accessibility.org/wcag20/rule/92">WCAG Rule 92: Role value must be valid</a></li>
|
||||
|
|
|
@ -98,40 +98,40 @@ const e = <div role={undefined} /> `;
|
|||
TestHelper.assertViolations(ruleName, fileName, [
|
||||
{
|
||||
failure:
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria/roles#role" +
|
||||
'_definitions, or simply remove this attribute',
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria-1.1/#role_definitions, " +
|
||||
'or simply remove this attribute',
|
||||
name: Utils.absolutePath('file.tsx'),
|
||||
ruleName: 'react-a11y-role',
|
||||
startPosition: { character: 16, line: 6 }
|
||||
},
|
||||
{
|
||||
failure:
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria/roles#role" +
|
||||
'_definitions, or simply remove this attribute',
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria-1.1/#role_definitions, " +
|
||||
'or simply remove this attribute',
|
||||
name: Utils.absolutePath('file.tsx'),
|
||||
ruleName: 'react-a11y-role',
|
||||
startPosition: { character: 16, line: 7 }
|
||||
},
|
||||
{
|
||||
failure:
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria/roles#role" +
|
||||
'_definitions, or simply remove this attribute',
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria-1.1/#role_definitions, " +
|
||||
'or simply remove this attribute',
|
||||
name: Utils.absolutePath('file.tsx'),
|
||||
ruleName: 'react-a11y-role',
|
||||
startPosition: { character: 16, line: 8 }
|
||||
},
|
||||
{
|
||||
failure:
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria/roles#role" +
|
||||
'_definitions, or simply remove this attribute',
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria-1.1/#role_definitions, " +
|
||||
'or simply remove this attribute',
|
||||
name: Utils.absolutePath('file.tsx'),
|
||||
ruleName: 'react-a11y-role',
|
||||
startPosition: { character: 16, line: 9 }
|
||||
},
|
||||
{
|
||||
failure:
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria/roles#role" +
|
||||
'_definitions, or simply remove this attribute',
|
||||
"'role' attribute empty. Either select a role from https://www.w3.org/TR/wai-aria-1.1/#role_definitions, " +
|
||||
'or simply remove this attribute',
|
||||
name: Utils.absolutePath('file.tsx'),
|
||||
ruleName: 'react-a11y-role',
|
||||
startPosition: { character: 16, line: 10 }
|
||||
|
|
|
@ -270,7 +270,7 @@ react-a11y-no-onchange,"For accessibility of your website, enforce usage of onBl
|
|||
react-a11y-props,Enforce all `aria-*` attributes are valid. Elements cannot use an invalid `aria-*` attribute.,TSLINT1682S78,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
|
||||
react-a11y-proptypes,Enforce ARIA state and property values are valid.,TSLINT1DLB1JE,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
|
||||
react-a11y-required,Enforce that required input elements must have aria-required set to true,TSLINTNF1C97,tslint,Non-SDL,Warning,Low,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
|
||||
react-a11y-role,"Elements with aria roles must use a **valid**, **non-abstract** aria role. A reference to role definitions can be found at [WAI-ARIA roles](https://www.w3.org/TR/wai-aria/roles#role_definitions).",TSLINTQ0A2FU,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
|
||||
react-a11y-role,"Elements with aria roles must use a **valid**, **non-abstract** aria role. A reference to role definitions can be found at [WAI-ARIA roles](https://www.w3.org/TR/wai-aria-1.1/#role_definitions).",TSLINTQ0A2FU,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
|
||||
react-a11y-role-has-required-aria-props,Elements with aria roles must have all required attributes according to the role.,TSLINT1R1B60O,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
|
||||
react-a11y-role-supports-aria-props,"Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`. Many aria attributes (states and properties) can only be used on elements with particular roles. Some elements have implicit roles, such as `<a href='hrefValue' />`, which will be resolved to `role='link'`. A reference for the implicit roles can be found at [Default Implicit ARIA Semantics](https://www.w3.org/TR/html-aria/#sec-strong-native-semantics).",TSLINT1IFADTQ,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
|
||||
react-a11y-tabindex-no-positive,Enforce tabindex value is **not greater than zero**.,TSLINTEO7FKT,tslint,Non-SDL,Warning,Important,Opportunity for Excellence,See description on the tslint or tslint-microsoft-contrib website,TSLint Procedure,,
|
||||
|
|
Не удается отобразить этот файл, потому что он содержит неожиданный символ в строке 156 и столбце 45.
|
Загрузка…
Ссылка в новой задаче