@@ -21,7 +21,7 @@ Labels are typically placed on top or to the left of the form fields:
21
21
</form >
22
22
```
23
23
24
- <common-codepen-snippet title =" Simple Form " slug =" YzwpPYZ " :height =" 368 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
24
+ <common-codepen-snippet title =" Simple Form " slug =" dyNzzWZ " :height =" 368 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
25
25
26
26
Notice how you can include ` autocomplete='on' ` on the form element and it will apply to all inputs in your form. You can also set different [ values for autocomplete attribute] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete ) for each input.
27
27
@@ -34,7 +34,7 @@ Provide labels to describe the purpose of all form control; linking `for` and `i
34
34
<input type =" text" name =" name" id =" name" v-model =" name" />
35
35
```
36
36
37
- <common-codepen-snippet title =" Form Label " slug =" wvMrGqz " :height =" 265 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
37
+ <common-codepen-snippet title =" Form Label " slug =" XWpaaaj " :height =" 265 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
38
38
39
39
If you inspect this element in your chrome developer tools and open the Accessibility tab inside the Elements tab, you will see how the input gets its name from the label:
40
40
@@ -68,7 +68,7 @@ You can also give the input an accessible name with [`aria-label`](https://devel
68
68
/>
69
69
```
70
70
71
- <common-codepen-snippet title =" Form ARIA label " slug =" jOWGqgz " :height =" 265 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
71
+ <common-codepen-snippet title =" Form ARIA label " slug =" NWdvvYQ " :height =" 265 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
72
72
73
73
Feel free to inspect this element in Chrome DevTools to see how the accessible name has changed:
74
74
@@ -100,7 +100,7 @@ Using [`aria-labelledby`](https://developer.mozilla.org/en-US/docs/Web/Accessibi
100
100
</form >
101
101
```
102
102
103
- <common-codepen-snippet title =" Form ARIA labelledby " slug =" ZEQXOLP " :height =" 265 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
103
+ <common-codepen-snippet title =" Form ARIA labelledby " slug =" MWJvvBe " :height =" 265 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
104
104
105
105
![ Chrome Developer Tools showing input accessible name from aria-labelledby] ( /images/AccessibleARIAlabelledbyDevTools.png )
106
106
@@ -132,7 +132,7 @@ Using [`aria-labelledby`](https://developer.mozilla.org/en-US/docs/Web/Accessibi
132
132
</form >
133
133
```
134
134
135
- <common-codepen-snippet title =" Form ARIA describedby " slug =" JjGrKyY " :height =" 265 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
135
+ <common-codepen-snippet title =" Form ARIA describedby " slug =" gOgxxQE " :height =" 265 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
136
136
137
137
You can see the description by inspecting Chrome DevTools:
138
138
@@ -144,7 +144,7 @@ Avoid using placeholders as they can confuse many users.
144
144
145
145
One of the issues with placeholders is that they don't meet the [ color contrast criteria] ( https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html ) by default; fixing the color contrast makes the placeholder look like pre-populated data in the input fields. Looking at the following example, you can see that the Last Name placeholder which meets the color contrast criteria looks like pre-populated data:
146
146
147
- <common-codepen-snippet title =" Form Placeholder " slug =" PoZJzeQ " :height =" 265 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
147
+ <common-codepen-snippet title =" Form Placeholder " slug =" ExZvvMw " :height =" 265 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
148
148
149
149
It is best to provide all the information the user needs to fill out forms outside any inputs.
150
150
@@ -178,7 +178,7 @@ Alternatively, you can attach the instructions to the input with [`aria-describe
178
178
</fieldset >
179
179
```
180
180
181
- <common-codepen-snippet title =" Form Instructions " slug =" GRoMqYy " :height =" 265 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
181
+ <common-codepen-snippet title =" Form Instructions " slug =" WNREEqv " :height =" 265 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
182
182
183
183
### Hiding Content
184
184
@@ -212,7 +212,7 @@ We can use CSS to visually hide elements but keep them available for assistive t
212
212
}
213
213
```
214
214
215
- <common-codepen-snippet title =" Form Search " slug =" qBbpQwB " :height =" 265 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
215
+ <common-codepen-snippet title =" Form Search " slug =" QWdMqWy " :height =" 265 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
216
216
217
217
#### aria-hidden="true"
218
218
@@ -240,7 +240,7 @@ You can also use an input to create buttons:
240
240
</form >
241
241
```
242
242
243
- <common-codepen-snippet title =" Form Buttons " slug =" PoZEXoj " :height =" 467 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
243
+ <common-codepen-snippet title =" Form Buttons " slug =" JjEyrYZ " :height =" 467 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
244
244
245
245
#### Functional Images
246
246
@@ -276,4 +276,4 @@ You can use this technique to create functional images.
276
276
</form >
277
277
```
278
278
279
- <common-codepen-snippet title =" Functional Images " slug =" NWxXeqY " :height =" 265 " tab =" js,result " :team = " false " user = " mlama007 " name = " Maria " theme =" light " :preview =" false " :editable =" false " />
279
+ <common-codepen-snippet title =" Functional Images " slug =" jOyLGqM " :height =" 265 " tab =" js,result " theme =" light " :preview =" false " :editable =" false " />
0 commit comments