Skip to content

Commit b8b37fc

Browse files
authored
Update README.md
1 parent 0ab2284 commit b8b37fc

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

README.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<h1>react-three-a11y👩‍🦯</h1>
22

3+
[![Version](https://img.shields.io/npm/v/@react-three/a11y?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/@react-three/a11y)
4+
[![Downloads](https://img.shields.io/npm/dt/@react-three/a11y.svg?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/@react-three/a11y)
5+
[![Discord Shield](https://img.shields.io/discord/740090768164651008?style=flat&colorA=000000&colorB=000000&label=discord&logo=discord&logoColor=ffffff)](https://discord.gg/ZZjjNvJ)
6+
37
An easy to use package designed to bring accessibility features to [react-three-fiber](https://github.com/pmndrs/react-three-fiber) such as focus indication, keyboard tab navigation, and screen reader support.
48

59
# How to use
@@ -8,16 +12,11 @@ An easy to use package designed to bring accessibility features to [react-three-
812

913
Install the @react-three/a11y package
1014

11-
with npm :
1215
```bash
1316
npm install @react-three/a11y
1417
```
15-
with yarn
16-
```bash
17-
yarn add @react-three/a11y
18-
```
1918

20-
Now, you'll have to import the A11yAnnouncer component. We usually place it next to the R3F Canvas component.
19+
Now, you'll have to import the `A11yAnnouncer` component. We usually place it next to the R3F Canvas component.
2120

2221
```jsx
2322
import { A11yAnnouncer } from "@react-three/a11y"
@@ -28,10 +27,9 @@ Now, you'll have to import the A11yAnnouncer component. We usually place it next
2827
<A11yAnnouncer />
2928
```
3029

31-
This will both help us emulate focus inside the canvas and provide some text to screen readers when nescessary.
30+
This will both help us emulate focus inside the canvas and provide some text to screen readers when necessary.
3231

33-
Then to add some accessibility features to your 3D Objects / Groups of 3D object you'll have to import the A11y component too.
34-
Then you wrap the 3D objects you want to make focusable like so
32+
To add some accessibility features to your 3D Objects/Groups you'll have to wrap the 3D objects you want to make focusable with the `A11y` component:
3533

3634
```jsx
3735
import { A11yAnnouncer, A11y } from "@react-three/a11y"
@@ -50,15 +48,13 @@ Then you wrap the 3D objects you want to make focusable like so
5048
<A11yAnnouncer />
5149
```
5250

53-
At this point both My3DComponent and AGroupOf3DComponent can receive focus.
54-
More presciesly, the emulated "focus" will be on the parent A11y that will act as a provider and give the possibility to it's children to access the state.
51+
At this point both *My3DComponent* and *AGroupOf3DComponent* can receive focus.
52+
More accurately, the emulated "focus" will be on the parent `A11y` that will act as a provider and let its children access the state.
5553
But even if they're focusable, nothing will be displayed / read etc without a few more attributes.
5654

57-
## accessing the hover / focused / pressed state
58-
59-
For each child wrapped in a A11y component, you can access the focus / hover / pressed state like so
55+
## Accessing the hover, focused & pressed state
6056

61-
import useA11y from '@react-three/a11y' then
57+
For each child wrapped in a `A11y` component, you can access the `focus` / `hover` / `pressed` state like so:
6258

6359
```jsx
6460
import { A11yAnnouncer, A11y, useA11y } from "@react-three/a11y"
@@ -72,18 +68,17 @@ import useA11y from '@react-three/a11y' then
7268
//now you have access to a11yContext.hover, a11yContext.focus and a11yContext.pressed
7369

7470
return (
75-
<mesh
76-
{...props}
71+
<mesh {...props}>
7772
<boxBufferGeometry args={[1, 1, 1]} />
78-
//here we'll change the material color depending on the a11yContext state
73+
{/* here we'll change the material color depending on the a11yContext state */}
7974
<meshStandardMaterial color={a11yContext.hover || a11yContext.focus ? 'hotpink' : 'orange'} />
8075
</mesh>
8176
)
8277
}
8378
```
8479

85-
In this example, the meshStandardMaterial of the component My3DComponent will change color if he is either focused or hovered.
86-
How you display the focus / hover information to the user is up to you ! Just make sure it's intuitive for your user !
80+
In this example, the *meshStandardMaterial* of the component *My3DComponent* will change color if he is either focused or hovered.
81+
How you display the focus / hover information to the user is up to you! Just make sure it's intuitive for your user!
8782

8883
## The role attribute
8984

0 commit comments

Comments
 (0)