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
<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
145
145
<My3DSquare />
146
146
</A11y>
147
147
{...}
@@ -154,14 +154,15 @@ Optionally, you can also show the description to the user on hover by setting `s
154
154
<A11yAnnouncer />
155
155
```
156
156
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
+
158
159
-`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.
160
161
-`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.
<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:
170
171
</A11y>
171
172
{...}
172
173
<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"
175
176
pressedDescription="This button can disable dark theme. Dark theme is on"
176
177
activationMsg="Dark theme enabled"
177
-
desactivationMsg="Dark theme disabled"
178
+
deactivationMsg="Dark theme disabled"
178
179
>
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
180
181
<My3DSphere />
181
182
</A11y>
182
183
{...}
183
184
</Canvas>
184
185
<A11yAnnouncer />
185
186
```
186
187
187
-
## The three roles of the `A11y` component
188
+
## The three roles of the `A11y` component
188
189
189
190
#### `content`
191
+
190
192
`cursor: default`
191
193
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.
192
194
It's not meant to trigger anything on click or to be activable with the Keyboard.
193
195
Therefore it won't show a pointer cursor on hover.
194
196
195
197
#### `button`
198
+
196
199
`cursor: pointer`
197
-
Special attributes : activationMsg, desactivationMsg, pressedDescription
200
+
Special attributes : activationMsg, deactivationMsg, pressedDescription
198
201
This role is meant to emulate the behaviour of a button or a togglable button.
199
202
It will display a cursor pointer when your cursor is over the linked 3D object.
200
203
It will call a function on click but also on any kind of action that would trigger a focused button ( Enter, Double-Tap .. )
201
204
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.
203
206
204
207
#### `link`
208
+
205
209
`cursor: pointer`
206
210
`special attributes : href`
207
211
This role is meant to emulate the behaviour of a regular html link.
208
212
It should be used in combination with something that will trigger navigation on click.
209
213
Just like the button one, it is accessible to all kind of user.
214
+
210
215
```diff
211
216
- Don't forget to provide the href attribute as he is required for screen readers to read it correctly !
212
217
- 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
219
224
## Additionals Features
220
225
221
226
Use a custom tabindex with for your A11y components by providing a number to the tabIndex attribute
227
+
222
228
```jsx
223
-
<A11y tabIndex={2}>
224
-
<My3DSquare />
225
-
</A11y>
229
+
<A11y tabIndex={2}>
230
+
<My3DSquare />
231
+
</A11y>
226
232
```
233
+
227
234
More about the use of tabIndex on <ahref="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex">developer.mozilla.org</a>
0 commit comments