Skip to content

Commit 3e9e4b5

Browse files
author
Erin Doyle
committed
Renamed a number of rules that were equivalent to existing rules in the eslint-plugin-jsx-a11y library for consistency between the two libs
1 parent 58e525f commit 3e9e4b5

16 files changed

Lines changed: 50 additions & 47 deletions
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# valid-aria-role
1+
# aria-role
22

33
The ARIA roles model requires that elements with a role attribute use a valid,
44
non-abstract ARIA role. Each non-abstract ARIA role is mapped on to a known set
@@ -16,7 +16,7 @@ on additional required attributes, on the
1616

1717
## Passes
1818

19-
```js
19+
```jsx harmony
2020
// passes when there is a role and it is valid
2121
<div role="button"></div>
2222

@@ -26,7 +26,7 @@ on additional required attributes, on the
2626

2727
## Fails
2828

29-
```js
29+
```jsx harmony
3030
// fails when there is an invalid `role`
3131
<div role="foo"></div>
3232
```

docs/rules/no-unsupported-elements-use-aria.md renamed to docs/rules/aria-unsupported-elements.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# no-unsupported-elements-use-aria
1+
# aria-unsupported-elements
22

33

44
Certain reserved DOM elements do not support ARIA roles, states and properties.
@@ -14,8 +14,8 @@ This is often because they are not visible, for example `meta`, `html`, `script`
1414
## Passes
1515

1616
These elements are passed by this rule
17-
```js
18-
// no problem when the reserver element is not given an illegal prop
17+
```jsx harmony
18+
// no problem when the reserved element is not given an illegal prop
1919
<meta/>
2020

2121
// no problem when an illegal props is given to a non-reserved elemeent
@@ -25,11 +25,11 @@ These elements are passed by this rule
2525
## Fails
2626

2727
These elements are *not* passed by this rule
28-
```js
28+
```jsx harmony
2929
// warns when the element should not be given any ARIA attributes
3030
<meta aria-hidden="false"/>
3131
```
3232

3333
## See also
3434

35-
- Google Audit defs [AX_ARIA_12](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-defs#ax_aria_12)
35+
- Google Audit defs [AX_ARIA_12](https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-defs#ax_aria_12)

docs/rules/hidden-uses-tabindex.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ in a hidden tab stop for screen reader users.
1212

1313
## Passes
1414

15-
```js
15+
```jsx harmony
1616
// passes when an interactive element is aria-hidden and has tabindex="-1"
1717
<input aria-hidden="true" tabindex="-1"/>
1818

@@ -25,7 +25,7 @@ in a hidden tab stop for screen reader users.
2525

2626
## Fails
2727

28-
```js
28+
```jsx harmony
2929
// fails when an interactive element is hidden but has no tabindex
3030
<input aria-hidden="true"/>
3131

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# redundant-alt
1+
# img-redundant-alt
22

33
Enforce img alt attribute does not contain the word image, picture, or photo.
44
Screenreaders already announce `img` elements as an image. There is no need to use
@@ -13,7 +13,7 @@ This rule takes the following options:
1313

1414
## Passes
1515

16-
```js
16+
```jsx harmony
1717
// passes when the `alt` does not contain redundant words
1818
<img src="foo" alt="nice"/>
1919

@@ -27,7 +27,7 @@ This rule takes the following options:
2727

2828
## Fails
2929

30-
```js
30+
```jsx harmony
3131
// fails when is a redundant alt message
3232
<img src="foo" alt="bar image foo"/>
3333

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# onclick-uses-tabindex
1+
# interactive-supports-focus
22

33
Enforce that elements that have an `onClick` handler also have
44
a `tabIndex` property. If not, they will not be navigable by
@@ -11,22 +11,22 @@ keyboard users.
1111

1212
## Passes
1313

14-
```js
14+
```jsx harmony
1515
// passes when when there is an `onClick` with a `tabIndex`
16-
<span tabindex="0"></span>
16+
<span onClick={someFunction} tabindex="0"></span>
1717

1818
// passes when the element is hidden from aria
19-
<span aria-hidden="true"></span>
19+
<span onClick={someFunction} aria-hidden="true"></span>
2020

2121
// passes when the element is interactive
22-
<button></button>
22+
<button onClick={someFunction}></button>
2323
```
2424

2525
## Fails
2626

27-
```js
27+
```jsx harmony
2828
// fails when there is an `onClick` with no `tabIndex`
29-
<span></span>
29+
<span onClick={someFunction}></span>
3030
```
3131

3232
## See also
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# label-uses-for
1+
# label-has-for
22

33
Enforce label tags have `htmlFor` attribute. Form controls using a `label` to
44
identify them must have only one label that is programmatically associated with
@@ -11,7 +11,7 @@ the control using: `<label htmlFor={/* ID or name of control*/}>...</label>`.
1111

1212
## Passes
1313

14-
```js
14+
```jsx harmony
1515
// passes when the label is hidden
1616
<label aria-hidden="true"></label>
1717

@@ -24,7 +24,7 @@ the control using: `<label htmlFor={/* ID or name of control*/}>...</label>`.
2424

2525
## Fails
2626

27-
```js
27+
```jsx harmony
2828
// fails when a label is not hidden and has no `htmlFor`
2929
<label></label>
3030
```

docs/rules/mouse-events-map-to-key-events.md renamed to docs/rules/mouse-events-have-key-events.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# mouse-events-map-to-key-events
1+
# mouse-events-have-key-events
22

33
Enforce `onMouseOver`/`onMouseOut` are accompanied by
44
`onFocus`/`onBlur`. Coding for the keyboard is important for users with
@@ -12,25 +12,25 @@ users.
1212

1313
## Passes
1414

15-
```js
15+
```jsx harmony
1616
// passes when there is no `onMouseOver` or `onMouseOut`
1717
<div></div>
1818

19-
// passes when there is `onMouseOver` but and `onFocus`
20-
<div></div>
19+
// passes when there is `onMouseOver` and `onFocus`
20+
<div onMouseOver={someFunction} onFocus={someFunction}></div>
2121

22-
// passes when there is `onMouseOut` but and `onBlur`
23-
<div></div>
22+
// passes when there is `onMouseOut` and `onBlur`
23+
<div onMouseOut={someFunction} onBlur={someFunction}></div>
2424
```
2525

2626
## Fails
2727

28-
```js
28+
```jsx harmony
2929
// fails when there is `onMouseOver` but no `onFocus`
30-
<div></div>
30+
<div onMouseOver={someFunction}></div>
3131

3232
// fails when there is `onMouseOut` but no `onBlur`
33-
<div></div>
33+
<div onMouseOut={someFunction}></div>
3434
```
3535

3636
## See also
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# use-onblur-not-onchange
1+
# no-onchange
22

33
Enforce usage of onBlur over onChange for accessibility. onBlur must be used
44
instead of onChange, unless absolutely necessary and it causes no negative
@@ -11,25 +11,28 @@ consequences for keyboard only or screen reader users.
1111

1212
## Passes
1313

14-
```js
14+
```jsx harmony
1515
// passes when there is no `onChange` prop
1616
<input/>
1717

1818
// passes when the element is aria-hidden
19-
<input aria-hidden="true"/>
19+
<input onChange={fn} aria-hidden="true"/>
2020

2121
// passes when the element is aria-disabled
22-
<input aria-disabled="true"/>
22+
<input onChange={fn} aria-disabled="true"/>
2323

2424
// passes when the element is aria-readonly
25-
<input aria-readonly="true"/>
25+
<input onChange={fn} aria-readonly="true"/>
26+
27+
// passes when there is an `onChange` prop and an `onBlur` prop
28+
<input onChange={fn} onBlur={fn}/>
2629
```
2730

2831
## Fails
2932

30-
```js
31-
// fails when the `onChange` prop is present
32-
<input/>
33+
```jsx harmony
34+
// fails when the `onChange` prop is present without an `onBlur` prop
35+
<input onChange={fn}/>
3336
```
3437

3538
## See also
File renamed without changes.

0 commit comments

Comments
 (0)