You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
4
8
5
9
# How to use
@@ -8,16 +12,11 @@ An easy to use package designed to bring accessibility features to [react-three-
8
12
9
13
Install the @react-three/a11y package
10
14
11
-
with npm :
12
15
```bash
13
16
npm install @react-three/a11y
14
17
```
15
-
with yarn
16
-
```bash
17
-
yarn add @react-three/a11y
18
-
```
19
18
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.
21
20
22
21
```jsx
23
22
import { A11yAnnouncer } from"@react-three/a11y"
@@ -28,10 +27,9 @@ Now, you'll have to import the A11yAnnouncer component. We usually place it next
28
27
<A11yAnnouncer />
29
28
```
30
29
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.
32
31
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:
@@ -50,15 +48,13 @@ Then you wrap the 3D objects you want to make focusable like so
50
48
<A11yAnnouncer />
51
49
```
52
50
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.
55
53
But even if they're focusable, nothing will be displayed / read etc without a few more attributes.
56
54
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
60
56
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:
0 commit comments