@@ -36,7 +36,8 @@ include ../_util-fns
36
36
37
37
.l-sub-section
38
38
:marked
39
- `ARIA`, or `Accessible Rich Internet Applications` refers to bringing `a11y` concepts into
39
+ `ARIA`, or `Accessible Rich Internet Applications` refers to a standard set of attributes for adding accessibility
40
+ information to `HTML` and `SVG`. This allows us to bring `a11y` concepts into
40
41
internet applications like those we are building with Angular 2.
41
42
42
43
:marked
@@ -112,7 +113,7 @@ include ../_util-fns
112
113
113
114
[Component that knows its own role](#component-roles)
114
115
115
- [Managing focus](#managin -focus)
116
+ [Managing focus](#managing -focus)
116
117
117
118
.l-sub-section
118
119
:marked
@@ -134,7 +135,7 @@ include ../_util-fns
134
135
A nightmare right? Users will leave so fast the bouncerate counter will be able to power a small town it will be
135
136
spinning *THAT* fast.
136
137
137
- We can avoid this from ever happening by simply adding a label for each field. Generaly this is not out problem,
138
+ We can avoid this from ever happening by simply adding a label for each field. Generally this is not our problem,
138
139
however the users of our website may not always be able to see or recognise these labels without assistance.
139
140
140
141
For this reason it is not only important to visually mark any form component, or as they are sometimes called,
@@ -247,7 +248,7 @@ code-example(language="html" escape="html").
247
248
The answer is no. But does that mean we get away with not labelling those fields at all?
248
249
249
250
Once again the answer is no.
250
-
251
+
251
252
So how do we solve it?
252
253
253
254
We can either use an `explicitly labelled` input and hide the label with style, or we can use the `aria-label`, which
@@ -283,9 +284,33 @@ code-example(language="html" escape="html").
283
284
.l-sub-section
284
285
:marked
285
286
So why not simply always use `aria-label`? This is because adding the `label` element not only provides the visual
286
- label, but linking a `label` to a `form control` also means that clicking on the `label` will select the
287
+ label, but linking a `label` to a `native form control` also means that clicking on the `label` will select the
287
288
`form control` itself. This touches on another area of `a11y`, as this also assists users with motor disabilites
288
289
to more easily select them.
290
+
291
+ :marked
292
+ Lets have a look at a quick comparison between using this method as opposed to not taking `a11y` into account at all.
293
+
294
+ Here is what happens if we have an `input` for filtering criteria that does not take any `a11y` into account. We will
295
+ use the accessibility tools in the newest development version of `Chrome`, although you can use one of various internal
296
+ and external web browser tools to test accessibility. This is the information that assistive technologies will
297
+ use when reading our field out:
298
+
299
+ figure.image-display
300
+ img( src ="/resources/images/cookbooks/a11y/invisible-label-input-not-labelled.png" alt ="Input with invisible label not labelled correctly" )
301
+
302
+ :marked
303
+ We can clearly see that the only description a user with a screen reader will get is **Enter a value**. What value?
304
+
305
+ Just imagine if there are more than one input on the same page with the same placeholder. Utter chaos!
306
+
307
+ Now lets put our `a11y` info back and look at the same input again:
308
+
309
+ figure.image-display
310
+ img( src ="/resources/images/cookbooks/a11y/invisible-label-input-labelled.png" alt ="Input with invisible label labelled correctly" )
311
+
312
+ :marked
313
+ Immediately it is clear what this `input` field is and what the user is supposed to enter in it!
289
314
290
315
:marked
291
316
### Labelling custom form controls
@@ -296,7 +321,7 @@ code-example(language="html" escape="html").
296
321
297
322
How would you go about making these custom form controls accessible?
298
323
299
- Fear not, there is a way! We introduce the next addition to our `ARIA` toolkit, and that is `aria-labeledby `.
324
+ Fear not, there is a way! We introduce the next addition to our `ARIA` toolkit, and that is `aria-labelledby `.
300
325
301
326
Why do we need this? Because the native `a11y` function of the `label` element is only recognised when used with
302
327
native `HTML` form control elements such as `input` and `textarea`. To label anything else, like a `div` or a
0 commit comments