/
form.html
325 lines (290 loc) · 14 KB
/
form.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<!DOCTYPE html >
<html lang="en">
<head>
<title>Form Landmark: ARIA Landmarks Example</title>
<meta charset="utf-8">
<link href="css/bootstrap.css" rel="stylesheet" media="screen"/>
<link href="css/bootstrap-theme.css" rel="stylesheet" media="screen"/>
<link href="css/bootstrap-accessibility.css" rel="stylesheet" media="screen"/>
<link href="css/visua11y.css" rel="stylesheet" media="screen"/>
<link href="css/common.css" rel="stylesheet" media="screen"/>
<style type="text/css">
label,
input[type=submit] {
display: block;
margin-top: 0.5em;
margin-bottom: 0;
padding-bottom: 0;
}
input[type=submit] {
margin-bottom: 1em;
}
fieldset {
padding: 0.5em;
margin-top: 1em;
padding-top: 1em;
background-color: #EEEEEE;
}
fieldset legend {
position: relative;
top: 1.5em;
border-color: #AAAAAA;
font-weight: bold;
font-size: 1em;
}
fieldset label {
font-weight: normal;
}
</style>
</head>
<body>
<div class="container">
<header class="row">
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-2">
<img src="images/w3c.png" alt="W3C Logo" />
</div>
<div class="col-xs-12 col-sm-9 col-md-9 col-lg-10">
<h1>ARIA Landmarks Example</h1>
<p id="inst" class="inst">Visually outline the landmarks and/or headings on the page using the following buttons.</p>
<button onclick="showLandmarks(event)" aria-describedby="inst">Show Landmarks</button>
<button onclick="showHeadings(event)" aria-describedby="inst">Show Headings</button>
</div>
</header>
<div class="row">
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-2">
<nav>
<ul class="nav nav-pills nav-stacked">
<li><a href="index.html">Principles</a></li>
<li><a href="HTML5.html">HTML5</a></li>
<li><a href="banner.html">Banner</a></li>
<li><a href="complementary.html">Complementary</a></li>
<li><a href="contentinfo.html">Contentinfo</a></li>
<li class="active"><a href="form.html" aria-current="page">Form</a></li>
<li><a href="main.html">Main</a></li>
<li><a href="navigation.html">Navigation</a></li>
<li><a href="region.html">Region</a></li>
<li><a href="search.html">Search</a></li>
<li><a href="at.html" aria-label="Assistive Technology">Asst. Tech.</a></li>
<li><a href="resources.html">Resources</a></li>
</ul>
</nav>
</div>
<div class="col-xs-12 col-sm-9 col-md-6 col-lg-7">
<main>
<h1 id="id1"> Form Landmark</h1>
<p> A <code>form</code> landmark identifies a region that contains a collection of items and objects that, as a whole, combine to create a form when no other named landmark is appropriate (e.g. main or search). </p>
<p> ARIA 1.1 Specification: <a href="https://www.w3.org/TR/wai-aria-1.1/#form"><code>form</code> landmark</a></p>
<h2>Design Patterns</h2>
<ul>
<li>Use the <code>search</code> landmark instead of the <code>form</code> landmark when the form is used for search functionality.</li>
<li>A <code>form</code> landmark should have a label to help users understand the purpose of the form.</li>
<li>A label for the <code>form</code> landmark should be identified using <code>aria-labelledby</code> to visible heading element (e.g. an <code>h1-h6</code> element).</li>
<li>If a page includes more than one <code>form</code> landmark, each should have a unique label.</li>
<li>
Whenever possible, controls contained in a <code>form</code> landmark in an HTML document should use native host semantics:
<ul>
<li><code>button</code></li>
<li><code>input</code></li>
<li><code>select</code></li>
<li><code>textarea</code></li>
</ul>
</li>
</ul>
<section aria-label="Coding Techniques">
<ul id="myTabs" class="nav nav-tabs" role="tablist">
<li class="active"><a id="tab1" href="#tabpanel1" aria-controls="tabpanel1" role="tab" data-toggle="tab">ARIA Techniques</a></li>
<li><a id="tab2" href="#tabpanel2" aria-controls="tabpanel2" role="tab" data-toggle="tab">HTML5 Techniques</a></li>
</ul>
<div class="tab-content">
<div id="tabpanel1" aria-labelledby="tab1" role="tabpanel" class="tab-pane active">
<ul>
<li>The <code>role="form"</code> attribute defines a form landmark.</li>
<li>Use the <code>role="form"</code> to identify a region of the page; do not use it to identify every form field.</li>
</ul>
<h3>ARIA Form Landmark Example</h3>
<p>Assume the following two forms (e.g. add contact and add organization) can be independently submitted from the same web page.</p>
<div role="form" aria-labelledby="contact">
<fieldset>
<legend id="contact">Add Contact</legend>
<label for="name">Name</label>
<input id="name" type="text" size="25">
<label for="email">E-mail</label>
<input id="email" type="text" size="25">
<label for="phone">Phone</label>
<input id="phone" type="text" size="25">
<input type="submit" value="Add Contact">
</fieldset>
</div>
<div role="form" aria-labelledby="organization">
<fieldset>
<legend id="organization">Add Organization</legend>
<label for="org">Organization</label>
<input id="org" type="text" size="25">
<label for="www">WWW</label>
<input id="www" type="text" size="25">
<input type="submit" value="Add Organization">
</fieldset>
</div>
<h3>Source Code</h3>
<div class="code">
<div <strong>role="form" aria-labelledby="contact"</strong>>
<br/>
<fieldset><br>
<br/>
<legend <strong>id="contact"</strong>>Add Contact </legend>
<br/>
<br/>
... <em>form controls add contact</em> ...
<br/>
<br/>
</fieldset>
<br/>
</div>
<br/>
<br/> ...............
<br/>
<br/>
<div <strong>role="form" aria-labelledby="organization"</strong>>
<br/>
<fieldset><br>
<br/>
<legend <strong>id="organization"</strong>>Add Organization </legend>
<br>
<br>
... <em>form controls add organization</em> ...
<br>
<br>
</fieldset>
<br>
</div>
<br>
</div>
</div>
<div id="tabpanel2" aria-labelledby="tab2" role="tabpanel" class="tab-pane">
<p>If a <code>form</code> element has an accessible name it is considered <code>form</code> landmark.</p>
<h3>HTML5 Form Landmark Example</h3>
<p>Assume the following two forms (e.g. add contact and add organization) can be independently submitted from the same web page.</p>
<form aria-labelledby="contact_html5">
<fieldset>
<legend id="contact_html5">Add Contact</legend>
<label for="name_html5">Name</label>
<input id="name_html5" type="text" size="25">
<label for="email_html5">E-mail</label>
<input id="email_html5" type="text" size="25">
<label for="phone_html5">Phone</label>
<input id="phone_html5" type="text" size="25">
<input type="submit" value="Add Contact">
</fieldset>
</form>
<form aria-labelledby="organization">
<fieldset>
<legend id="organization_html5">Add Organization</legend>
<label for="org_html5">Organization</label>
<input id="org_html5" type="text" size="25">
<label for="www_html5">WWW</label>
<input id="www_html5" type="text" size="25">
<input type="submit" value="Add Organization">
</fieldset>
</form>
<h3>Source Code</h3>
<div class="code">
<<strong>form aria-labelledby="contact"</strong>>
<br/>
<fieldset><br>
<br/>
<legend <strong>id="contact"</strong>>Add Contact </legend>
<br/>
<br/>
... <em>form controls add contact</em> ...
<br/>
<br/>
</fieldset>
<br/>
<<strong>/form</strong>>
<br/>
<br/> ...............
<br/>
<br/>
<<strong>form aria-labelledby="organization"</strong>>
<br/>
<fieldset><br>
<br/>
<legend <strong>id="organization"</strong>>Add Organization </legend>
<br>
<br>
... <em>form controls add organization</em> ...
<br>
<br>
</fieldset>
<br>
<<strong>/form</strong>>
<br>
</div>
</div>
</div>
</section>
</main>
</div>
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
<aside aria-labelledby="id4">
<h2 id="id4">Landmarks</h2>
<p>The following landmarks are defined on this page:</p>
<ul>
<li>Banner</li>
<li>Complementary</li>
<li>Contentinfo</li>
<li>Form</li>
<li>Main</li>
<li>Navigation</li>
<li>Region</li>
</ul>
</aside>
<aside aria-labelledby="id3">
<h2 id="id3">Related W3C Documents</h2>
<ul>
<li><a href="https://www.w3.org/TR/wai-aria-practices-1.1/">WAI-ARIA Authoring Practices 1.1</a></li>
<li><a href="http://www.w3.org/TR/2014/REC-wai-aria-20140320/">WAI-ARIA 1.0 Specification</a></li>
<li><a href="https://www.w3.org/TR/wai-aria-1.1/">WAI-ARIA 1.1 Specification</a></li>
<li><a href="https://www.w3.org/TR/accname-aam-1.1/">Accessible Name and Description: Computation and API Mappings 1.1</a></li>
<li><a href="http://www.w3.org/TR/core-aam-1.1/">Core Accessibility API Mappings 1.1</a></li>
<li><a href="https://www.w3.org/TR/html-aam-1.0/">HTML Accessibility API Mappings 1.0</a></li>
<li><a href="http://www.w3.org/TR/html5/">HTML5 Specification</a></li>
<li><a href="https://www.w3.org/TR/html-aria/">ARIA in HTML</a>
<li><a href="https://www.w3.org/TR/using-aria/">Using ARIA in HTML</a></li>
<li><a href="http://www.w3.org/TR/WCAG/">WCAG Specification</a></li>
</ul>
</aside>
</div>
</div>
<div class="well well-sm">
<footer class="row">
<div class="col-xs-12 col-sm-9 col-md-9 col-lg-10">
W3C ARIA Authoring Practices Task Force
</div>
<div class="col-xs-12 col-sm-3 col-md-3 col-lg-2">
Copyright 2016
</div>
</footer>
</div>
</div>
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-accessibility.min.js"></script>
<script type="text/javascript" src="js/bootstrap-accessibility-2.js"></script>
<script type="text/javascript" src="js/visua11y.js"></script>
<script type="text/javascript" src="js/show.js"></script>
<script type="text/javascript" >
// Use the SkipTo defaults, but just showing custom configuration
var SkipToConfig =
{
"settings": {
"skipTo": {
"headings": "h1, h2",
"attachElement": "header"
}
}
};
</script>
<script type="text/javascript" src="js/SkipTo.min.js"></script>
</body>
</html>