Skip to content

Commit 5a9a7b9

Browse files
authored
Merge pull request #199 from merlinpatt/patch-1
[Docs] Add ignoreNonDOM option
2 parents 06a0ff1 + c397d09 commit 5a9a7b9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/rules/aria-role.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,26 @@ Elements with ARIA roles must use a valid, non-abstract ARIA role. A reference t
77

88
## Rule details
99

10-
This rule takes no arguments.
10+
This rule takes one optional object argument of type object:
11+
12+
```
13+
{
14+
"rules": {
15+
"jsx-a11y/aria-role": [ 2, {
16+
"ignoreNonDOM": true
17+
}],
18+
}
19+
}
20+
```
21+
22+
For the `ignoreNonDOM` option, this determines if developer created components are checked.
1123

1224
### Succeed
1325
```jsx
1426
<div role="button"></div> <!-- Good: "button" is a valid ARIA role -->
1527
<div role={role}></div> <!-- Good: role is a variable & cannot be determined until runtime. -->
1628
<div></div> <!-- Good: No ARIA role -->
29+
<Foo role={role}></Foo> <!-- Good: ignoreNonDOM is set to true -->
1730
```
1831

1932
### Fail
@@ -22,4 +35,5 @@ This rule takes no arguments.
2235
<div role="datepicker"></div> <!-- Bad: "datepicker" is not an ARIA role -->
2336
<div role="range"></div> <!-- Bad: "range" is an _abstract_ ARIA role -->
2437
<div role=""></div> <!-- Bad: An empty ARIA role is not allowed -->
38+
<Foo role={role}></Foo> <!-- Bad: ignoreNonDOM is set to false or not set -->
2539
```

0 commit comments

Comments
 (0)