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">
@@ -169,17 +166,17 @@ Optionnaly, you can also show the description to the user when he hover it by se
169
166
</A11y>
170
167
{...}
171
168
</Canvas>
172
-
</A11yDom>
169
+
<A11yAnnouncer />
173
170
```
174
171
175
-
If your A11y component have the role="button", you can use two more attributes :
172
+
If your A11y component have the role="button", you can use three more attributes :
176
173
- activationMsg : When the user will click / activate the "button" the screen reader will read what you wrote in activationMsg
177
174
- desactivationMsg : When set, it turns your button in a togglable button. Which means he now has a on/off state. Screen readers will read the state of the button as well as the desactivation message / activation message that you set when toggling it.
175
+
- pressedDescription : When set, it turns your button in a togglable button. Which means he now has a on/off state. This will be read instead of the usual description when the button is on.
<A11y role="button" description="This button will send a thank you email to the team" activationMsg="Email is sending">
@@ -189,7 +186,8 @@ If your A11y component have the role="button", you can use two more attributes :
189
186
{...}
190
187
<A11y
191
188
role="button"
192
-
description="This button can enable and disable dark theme"
189
+
description="This button can enable dark theme. Dark theme is off"
190
+
pressedDescription="This button can disable dark theme. Dark theme is on"
193
191
activationMsg="Dark theme enabled"
194
192
desactivationMsg="Dark theme disabled"
195
193
>
@@ -198,17 +196,50 @@ If your A11y component have the role="button", you can use two more attributes :
198
196
</A11y>
199
197
{...}
200
198
</Canvas>
201
-
</A11yDom>
199
+
<A11yAnnouncer />
202
200
```
203
201
204
-
####content
202
+
## the three role of the A11y component
203
+
#### content
204
+
cursor: default
205
+
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.
206
+
It's not meant to trigger anything on click or to be activable with the Keyboard.
207
+
Therefore it won't show a pointer cursor on hover.
205
208
206
-
####button
209
+
#### button
210
+
cursor: pointer
211
+
Special attributes : activationMsg, desactivationMsg, pressedDescription
212
+
This role is meant to emulate the behaviour of a button or a togglable button.
213
+
It will display a cursor pointer when your cursor is over the linked 3D object.
214
+
It will call a function on click but also on any kind of action that would trigger a focused button ( Enter, Double-Tap .. )
215
+
It is also actionnable by user using a screen reader.
216
+
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.
207
217
208
-
####link
218
+
#### link
219
+
cursor: pointer
220
+
Special attributes : href
221
+
This role is meant to emulate the behaviour of a regular html link.
222
+
It should be used in combination with something that will trigger navigation on click.
223
+
Just like the button one, it is accessible to all kind of user.
224
+
```diff
225
+
- Don't forget to provide the href attribute as he is required for screen readers to read it correctly !
226
+
- It will have no effect on the navigation, it's just used as information
227
+
```
209
228
210
229
## Screen reader support
211
230
231
+
In order to provide informations to screen reader users and use this package at its full potential, fill the description attribute of all your A11y components and use the appropriate role attribute on each of them.
232
+
233
+
## Additionals features
234
+
235
+
Use a custom tabindex with for your A11y components by providing a number to the tabIndex attribute
236
+
```jsx
237
+
<A11y tabIndex={2} >
238
+
<My3DSquare />
239
+
</A11y>
240
+
```
241
+
More about the use of tabIndex on <ahref="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex">developer.mozilla.org</a>
242
+
212
243
## Next steps
213
244
214
245
-[ ] Improve the accessibility for mobile screen readers such as Voice Over and Talk Back
0 commit comments