Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Update w3 reference in the react-a11y-role rule #847

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,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>
Expand All @@ -1055,7 +1055,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>
Expand Down
6 changes: 3 additions & 3 deletions src/reactA11yRoleHasRequiredAriaPropsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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>`,
Expand Down
6 changes: 3 additions & 3 deletions src/reactA11yRoleRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ 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'
);
}

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 {
Expand All @@ -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>
Expand Down
20 changes: 10 additions & 10 deletions src/tests/reactA11yRoleRuleTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion tslint-warnings.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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,,
Expand Down