Skip to content

Commit 5b3374e

Browse files
committed
typo fix desactivation -> deactivation
1 parent 958e353 commit 5b3374e

File tree

3 files changed

+36
-29
lines changed

3 files changed

+36
-29
lines changed

README.md

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## Initial setup
1212

13-
Install the @react-three/a11y package
13+
Install the @react-three/a11y package
1414

1515
```bash
1616
npm install @react-three/a11y
@@ -33,7 +33,7 @@ To add some accessibility features to your 3D Objects/Groups you'll have to wrap
3333

3434
```jsx
3535
import { A11yAnnouncer, A11y } from "@react-three/a11y"
36-
36+
3737
<Canvas>
3838
{...}
3939
<A11y>
@@ -48,7 +48,7 @@ To add some accessibility features to your 3D Objects/Groups you'll have to wrap
4848
<A11yAnnouncer />
4949
```
5050

51-
At this point both *My3DComponent* and *AGroupOf3DComponent* can receive focus.
51+
At this point both _My3DComponent_ and _AGroupOf3DComponent_ can receive focus.
5252
More accurately, the emulated "focus" will be on the parent `A11y` that will act as a provider and let its children access the state.
5353
But even if they're focusable, nothing will be displayed / read etc without a few more attributes.
5454

@@ -58,7 +58,7 @@ For each child wrapped in a `A11y` component, you can access the `focus` / `hove
5858

5959
```jsx
6060
import { A11yAnnouncer, A11y, useA11y } from "@react-three/a11y"
61-
61+
6262
{...}
6363

6464
const My3DComponent = (props) {
@@ -77,10 +77,10 @@ For each child wrapped in a `A11y` component, you can access the `focus` / `hove
7777
}
7878
```
7979

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

83-
## The role attribute
83+
## The role attribute
8484

8585
Like in HTML, you can focus different kind of elements and expect different things depending on what you're focusing.
8686
That's why the `A11y` component has 3 different use cases:
@@ -98,7 +98,7 @@ You can for instance use it in order to make sure the currently focused element
9898

9999
```jsx
100100
import { A11yAnnouncer, A11y } from "@react-three/a11y"
101-
101+
102102
<Canvas>
103103
{...}
104104
<A11y role="content" focusCall={()=>{
@@ -117,7 +117,7 @@ The `actionCall` prop of `A11y` will be called each time this component gets cli
117117

118118
```jsx
119119
import { A11yAnnouncer, A11y } from "@react-three/a11y"
120-
120+
121121
<Canvas>
122122
{...}
123123
<A11y role="button" actionCall={()=>{
@@ -137,11 +137,11 @@ Optionally, you can also show the description to the user on hover by setting `s
137137

138138
```jsx
139139
import { A11yAnnouncer, A11y } from "@react-three/a11y"
140-
140+
141141
<Canvas>
142142
{...}
143143
<A11y role="content" description="A rotating red square">
144-
//will read "A rotating red square" to screen readers on focus / hover
144+
//will read "A rotating red square" to screen readers on focus / hover
145145
<My3DSquare />
146146
</A11y>
147147
{...}
@@ -154,14 +154,15 @@ Optionally, you can also show the description to the user on hover by setting `s
154154
<A11yAnnouncer />
155155
```
156156

157-
If your `A11y` component has the `role="button"`, you can use three more props:
157+
If your `A11y` component has the `role="button"`, you can use three more props:
158+
158159
- `activationMsg`: When the user will click/activate the "button" the screen reader will read the passed message
159-
- `desactivationMsg`: When set, it turns your button in a togglable button. Which means it now has a on/off state. Screen readers will read the state of the button as well as the activation/disactivation messages passsed.
160+
- `deactivationMsg`: When set, it turns your button in a togglable button. Which means it now has a on/off state. Screen readers will read the state of the button as well as the activation/disactivation messages passsed.
160161
- `pressedDescription`: When set, it turns your button in a togglable button. Which means it now has a on/off state. This description will replace the one passed via `description` when the toggle is active.
161162

162163
```jsx
163164
import { A11yAnnouncer, A11y } from "@react-three/a11y"
164-
165+
165166
<Canvas>
166167
{...}
167168
<A11y role="button" description="This button will send a thank you email to the team" activationMsg="Email is sending">
@@ -170,43 +171,47 @@ If your `A11y` component has the `role="button"`, you can use three more props:
170171
</A11y>
171172
{...}
172173
<A11y
173-
role="button"
174-
description="This button can enable dark theme. Dark theme is off"
174+
role="button"
175+
description="This button can enable dark theme. Dark theme is off"
175176
pressedDescription="This button can disable dark theme. Dark theme is on"
176177
activationMsg="Dark theme enabled"
177-
desactivationMsg="Dark theme disabled"
178+
deactivationMsg="Dark theme disabled"
178179
>
179-
//will read the description on hover / focus then will read activationMsg if turned on or desactivationMsg if tuned off
180+
//will read the description on hover / focus then will read activationMsg if turned on or deactivationMsg if tuned off
180181
<My3DSphere />
181182
</A11y>
182183
{...}
183184
</Canvas>
184185
<A11yAnnouncer />
185186
```
186187

187-
## The three roles of the `A11y` component
188+
## The three roles of the `A11y` component
188189

189190
#### `content`
191+
190192
`cursor: default`
191193
This role is meant to provide information to screen readers or to serve as a step for a user to navigate your site using Tab for instance.
192194
It's not meant to trigger anything on click or to be activable with the Keyboard.
193195
Therefore it won't show a pointer cursor on hover.
194196

195197
#### `button`
198+
196199
`cursor: pointer`
197-
Special attributes : activationMsg, desactivationMsg, pressedDescription
200+
Special attributes : activationMsg, deactivationMsg, pressedDescription
198201
This role is meant to emulate the behaviour of a button or a togglable button.
199202
It will display a cursor pointer when your cursor is over the linked 3D object.
200203
It will call a function on click but also on any kind of action that would trigger a focused button ( Enter, Double-Tap .. )
201204
It is also actionnable by user using a screen reader.
202-
You can turn it into a button with aria-pressed by providing the following properties desactivationMsg, pressedDescription in addition to the usual description and activationMsg properties.
205+
You can turn it into a button with aria-pressed by providing the following properties deactivationMsg, pressedDescription in addition to the usual description and activationMsg properties.
203206

204207
#### `link`
208+
205209
`cursor: pointer`
206210
`special attributes : href`
207211
This role is meant to emulate the behaviour of a regular html link.
208212
It should be used in combination with something that will trigger navigation on click.
209213
Just like the button one, it is accessible to all kind of user.
214+
210215
```diff
211216
- Don't forget to provide the href attribute as he is required for screen readers to read it correctly !
212217
- It will have no effect on the navigation, it's just used as information
@@ -219,11 +224,13 @@ In order to provide informations to screen reader users and use this package at
219224
## Additionals Features
220225

221226
Use a custom tabindex with for your A11y components by providing a number to the tabIndex attribute
227+
222228
```jsx
223-
<A11y tabIndex={2} >
224-
<My3DSquare />
225-
</A11y>
229+
<A11y tabIndex={2}>
230+
<My3DSquare />
231+
</A11y>
226232
```
233+
227234
More about the use of tabIndex on <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex">developer.mozilla.org</a>
228235

229236
## Next Steps

example/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const App = () => {
195195
setDarktheme(!darktheme)
196196
}}
197197
activationMsg="Theme Dark enabled"
198-
desactivationMsg="Theme Dark disabled">
198+
deactivationMsg="Theme Dark disabled">
199199
<SimpleToggleButton position={[0, -8, 0]} />
200200
</A11y>
201201
</Canvas>

src/A11y.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface Props {
88
description: string;
99
pressedDescription: string;
1010
activationMsg: string;
11-
desactivationMsg: string;
11+
deactivationMsg: string;
1212
tabIndex: number;
1313
href: string | undefined;
1414
role: 'button' | 'link' | 'content';
@@ -48,7 +48,7 @@ export const A11y: React.FC<Props> = ({
4848
description,
4949
pressedDescription,
5050
activationMsg,
51-
desactivationMsg,
51+
deactivationMsg,
5252
tabIndex,
5353
href,
5454
role,
@@ -92,7 +92,7 @@ export const A11y: React.FC<Props> = ({
9292

9393
function handleToggleBtnClick() {
9494
if (a11yState.pressed) {
95-
a11yScreenReader(desactivationMsg);
95+
a11yScreenReader(deactivationMsg);
9696
} else {
9797
a11yScreenReader(activationMsg);
9898
}
@@ -106,7 +106,7 @@ export const A11y: React.FC<Props> = ({
106106

107107
const HtmlFocusableElement = (() => {
108108
if (role === 'button') {
109-
if (desactivationMsg || pressedDescription) {
109+
if (deactivationMsg || pressedDescription) {
110110
//btn has two distinct state
111111
return (
112112
<button
@@ -261,7 +261,7 @@ export const A11y: React.FC<Props> = ({
261261
{...props}
262262
onClick={() => {
263263
if (role === 'button') {
264-
if (desactivationMsg || pressedDescription) {
264+
if (deactivationMsg || pressedDescription) {
265265
handleToggleBtnClick();
266266
} else {
267267
handleBtnClick();

0 commit comments

Comments
 (0)