Skip to content

Commit 82f598e

Browse files
yepninjaljharb
authored andcommitted
[Docs] examples: add language in code block for syntax highlight
1 parent 00926f2 commit 82f598e

9 files changed

+41
-39
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Rule | Recommended | Strict
169169
The following rules have extra options when in *recommended* mode:
170170

171171
#### no-interactive-element-to-noninteractive-role
172-
```
172+
```js
173173
'jsx-a11y/no-interactive-element-to-noninteractive-role': [
174174
'error',
175175
{
@@ -179,7 +179,7 @@ The following rules have extra options when in *recommended* mode:
179179
```
180180

181181
#### no-noninteractive-element-interactions
182-
```
182+
```js
183183
'jsx-a11y/no-noninteractive-element-interactions': [
184184
'error',
185185
{
@@ -196,7 +196,7 @@ The following rules have extra options when in *recommended* mode:
196196
```
197197

198198
#### no-noninteractive-element-to-interactive-role
199-
```
199+
```js
200200
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
201201
'error',
202202
{
@@ -226,7 +226,7 @@ The following rules have extra options when in *recommended* mode:
226226
```
227227

228228
#### no-noninteractive-tabindex
229-
```
229+
```js
230230
'jsx-a11y/no-noninteractive-tabindex': [
231231
'error',
232232
{
@@ -237,7 +237,7 @@ The following rules have extra options when in *recommended* mode:
237237
```
238238

239239
#### no-static-element-interactions
240-
```
240+
```js
241241
'jsx-a11y/no-noninteractive-element-interactions': [
242242
'error',
243243
{

docs/rules/aria-role.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Elements with ARIA roles must use a valid, non-abstract ARIA role. A reference t
99

1010
This rule takes one optional object argument of type object:
1111

12-
```
12+
```json
1313
{
1414
"rules": {
1515
"jsx-a11y/aria-role": [ 2, {

docs/rules/interactive-supports-focus.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This element is a stand-alone control like a button, a link or a form element. A
1010

1111
Add the `tabIndex` property to your component. A value of zero indicates that this element can be tabbed to.
1212

13-
```
13+
```jsx
1414
<div
1515
role="button"
1616
tabIndex={0} />
@@ -26,7 +26,7 @@ Generally buttons, links and form elements should be reachable via tab key press
2626

2727
This element is part of a group of buttons, links, menu items, etc. Or this element is part of a composite widget. Composite widgets prescribe standard [keyboard interaction patterns](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_generalnav). Within a group of similar elements -- like a button bar -- or within a composite widget, elements that can be focused are given a tabindex of -1. This makes the element *focusable* but not *tabbable*. Generally one item in a group should have a tabindex of zero so that a user can tab to the component. Once an element in the component has focus, your key management behaviors will control traversal within the component's pieces. As the UI author, you will need to implement the key handling behaviors such as listening for traversal key (up/down/left/right) presses and moving the page focus between the focusable elements in your widget.
2828

29-
```
29+
```jsx
3030
<div role="menu">
3131
<div role="menuitem" tabIndex="0">Open</div>
3232
<div role="menuitem" tabIndex="-1">Save</div>
@@ -40,7 +40,7 @@ In the example above, the first item in the group can be tabbed to. The develope
4040

4141
If your element is catching bubbled click or key events from descendant elements, then the proper role for this element is `presentation`.
4242

43-
```
43+
```jsx
4444
<div
4545
onClick={onClickHandler}
4646
role="presentation">
@@ -60,28 +60,30 @@ Marking an element with the role `presentation` indicates to assistive technolog
6060

6161
This rule takes an options object with the key `tabbable`. The value is an array of interactive ARIA roles that should be considered tabbable, not just focusable. Any interactive role not included in this list will be flagged as needing to be focusable (tabindex of -1).
6262

63-
```
64-
'jsx-a11y/interactive-supports-focus': [
65-
'error',
66-
{
67-
tabbable: [
68-
'button',
69-
'checkbox',
70-
'link',
71-
'searchbox',
72-
'spinbutton',
73-
'switch',
74-
'textbox',
75-
],
76-
},
77-
]
63+
```js
64+
{
65+
'jsx-a11y/interactive-supports-focus': [
66+
'error',
67+
{
68+
tabbable: [
69+
'button',
70+
'checkbox',
71+
'link',
72+
'searchbox',
73+
'spinbutton',
74+
'switch',
75+
'textbox',
76+
],
77+
},
78+
]
79+
}
7880
```
7981

8082
The recommended options list interactive roles that act as form elements. Generally, elements with a role like `menuitem` are a part of a composite widget. Focus in a composite widget is controlled and moved programmatically to satisfy the prescribed [keyboard interaction pattern](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_generalnav) for the widget.
8183

8284
The list of possible values includes:
8385

84-
```
86+
```js
8587
[
8688
'button',
8789
'checkbox',

docs/rules/no-autofocus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Enforce that autoFocus prop is not used on elements. Autofocusing elements can c
99

1010
This rule takes one optional object argument of type object:
1111

12-
```
12+
```json
1313
{
1414
"rules": {
1515
"jsx-a11y/no-autofocus": [ 2, {

docs/rules/no-interactive-element-to-noninteractive-role.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Non-interactive HTML elements and non-interactive ARIA roles indicate _content_
1212

1313
Wrap your interactive element in a `<div>` with the desired role.
1414

15-
```
15+
```jsx
1616
<div role="article">
1717
<button>Save</button>
1818
</div>
@@ -22,7 +22,7 @@ Wrap your interactive element in a `<div>` with the desired role.
2222

2323
Put the content inside your interactive element.
2424

25-
```
25+
```jsx
2626
<div
2727
role="button"
2828
onClick={() => {}}
@@ -45,7 +45,7 @@ The recommended options for this rule allow the `tr` element to be given a role
4545

4646
Options are provided as an object keyed by HTML element name; the value is an array of interactive roles that are allowed on the specified element.
4747

48-
```
48+
```js
4949
{
5050
'no-interactive-element-to-noninteractive-role': [
5151
'error',
@@ -58,6 +58,6 @@ Options are provided as an object keyed by HTML element name; the value is an ar
5858

5959
Under the recommended options, the following code is valid. It would be invalid under the strict rules.
6060

61-
```
61+
```jsx
6262
<tr role="presentation" />
6363
```

docs/rules/no-noninteractive-element-interactions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ see [WAI-ARIA Authoring Practices Guide - Design Patterns and Widgets](https://w
2929

3030
Move the event handler function to an inner element like `<div>` and give that element a role of `presentation`. This leaves the _content_ or _container_ semantic value of this element intact.
3131

32-
```
32+
```jsx
3333
<div role="article">
3434
<div
3535
onClick="onClickHandler"
@@ -65,7 +65,7 @@ You have two options in this case.
6565

6666
For instance, move the button inside the cell:
6767

68-
```
68+
```jsx
6969
<table>
7070
<tr>
7171
<td><button>Sort</button></td>
@@ -79,7 +79,7 @@ This preserves the table cell semantics and the button semantics; the two are no
7979

8080
If your user interface has a table-like layout, but is filled with interactive components in the cells, consider converting the table into a grid.
8181

82-
```
82+
```jsx
8383
<table role="grid">
8484
<tr>
8585
<td role="gridcell" onClick={this.sort}>Sort</td>

docs/rules/no-noninteractive-element-to-interactive-role.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Interactive HTML elements indicate _controls_ in the user interface. Interactive
1313

1414
Put the control inside the non-interactive container element.
1515

16-
```
16+
```jsx
1717
<li>
1818
<div
1919
role="button"
@@ -26,7 +26,7 @@ Put the control inside the non-interactive container element.
2626

2727
Or wrap the content inside your interactive element.
2828

29-
```
29+
```jsx
3030
<div
3131
role="button"
3232
onClick={() => {}}
@@ -47,7 +47,7 @@ Or wrap the content inside your interactive element.
4747

4848
The recommended options for this rule allow several common interactive roles to be applied to a non-interactive element. The options are provided as an object keyed by HTML element name; the value is an array of interactive roles that are allowed on the specified element.
4949

50-
```
50+
```js
5151
{
5252
'no-noninteractive-element-to-interactive-role': [
5353
'error',
@@ -64,6 +64,6 @@ The recommended options for this rule allow several common interactive roles to
6464

6565
Under the recommended options, the following code is valid. It would be invalid under the strict rules.
6666

67-
```
67+
```jsx
6868
<ul role="menu" />
6969
```

docs/rules/no-noninteractive-tabindex.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Tab key navigation should be limited to elements on the page that can be interac
88

99
The `<a>` tag is tricky. Consider the following:
1010

11-
```
11+
```jsx
1212
<a>Edit</a>
1313
<a href="#">Edit</a>
1414
<a role="button">Edit</a>

docs/rules/no-redundant-roles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Some HTML elements have native semantics that are implemented by the browser. Th
99

1010
The default options for this rule allow an implicit role of `navigation` to be applied to a `nav` element as is [advised by w3](https://www.w3.org/WAI/GL/wiki/Using_HTML5_nav_element#Example:The_.3Cnav.3E_element). The options are provided as an object keyed by HTML element name; the value is an array of implicit ARIA roles that are allowed on the specified element.
1111

12-
```
12+
```js
1313
{
1414
'jsx-a11y/no-redundant-roles': [
1515
'error',

0 commit comments

Comments
 (0)