-
Notifications
You must be signed in to change notification settings - Fork 382
Expand file tree
/
Copy pathindex.html
More file actions
91 lines (86 loc) · 3.36 KB
/
index.html
File metadata and controls
91 lines (86 loc) · 3.36 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Forms: Using aria-invalid : WCAG 2</title>
<style>
body{
background:#fff;
color:#000;
font:100% / 1.5 sans-serif;
}
div.control label {
margin: 0;
padding: 0;
padding-right: .25em;
text-align: right;
clear: both;
float: left;
}
div.control {
margin: .5em;
}
input.error {
border: red thin solid;}
input[type=submit] {
clear: both;
padding: 0;
margin: 0;
margin-top: .5em;
margin-left: 13em;
}
span.errtext {
margin-bottom: 1em;
padding: .25em 1.4em .25em .25em;
border: red thin solid;
background-color: #EEEEFF;
background-image:url('images/iconError.gif');
background-repeat:no-repeat;
background-position:right;
}
</style>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="valcheck.js"></script>
</head>
<body>
<h2>Forms: Using aria-invalid to identify failed fields </h2>
<h3>Features</h3>
<ul>
<li>Places an aria-invalid attribute for a field only if the input data is not in the expected format. These also have generic error text alongside but the text is not tied to the field. </li>
<li>Uses a standard generic error message against every field when no data is entered. The error message is tied to the form control using aria-describedby.</li>
<li>The error displayed for a past date (after Jan 1, 2000) is associated with the field via markup</li>
<li>Every form control that fails validation has a red border and an error icon to its right (placed via CSS) for visual reinforcement</li>
<li>Date is not a required field; today's date is filled in as default</li>
<li>The error message placed above the form is within a span tag with role=alert. The SPAN tagg is within an h2 and is read by NVDA and JAWS. VoiceOver reads it in iOS and OSX.</li>
</ul>
<h2> <span role="alert" id="err_final" tabindex="-1"></span></h2>
<form action="#" method="post" id="login3" onsubmit="return errorAlert2()">
<div class="control">
<p><label for="pin4">Personal Id. Number (PIN) - 4 digits: [*]</label>
<input type="text" size="4" name="pin4" id="pin4"></p>
</div>
<div class="control">
<p><label for="email">Email address: [*]</label>
<input type="text" name="email" id="email"> </p>
</div>
<div class="control">
<p><label for="lname">Last name: [*]</label>
<input type="text" name="lname" id="lname" size="12"> </p>
</div>
<div class="control">
<p><label for="startDt">Desired policy start date (MM / DD / YYYY)</label>
<input type="text" name="startDt" id="startDt" size="12"> </p>
</div>
<p><input type="hidden" name="spanval" id="spanval">
<input type="submit" value="Login" id="next_btn" name="next_btn"></p>
</form>
<h3>About the error messages</h3>
<ul>
<li>JAWS and NVDA expose a field with aria-invalid=true as "invalid entry".</li>
<li>VoiceOver with Safari on OSX or iOS reads out the field as "invalid data"</li>
<li>The field's label (or other accessible name) is announced before the "invalid" notification.</li>
<li>The field-specific error messages when associated with aria-describedby are read by JAWS and NVDA as one tabs to the fields. VoiceOver reads these automatically only in iOS ... the error message is announced after a slight pause after the label is read. In OSX on a MacBook Pro, the VO+Shift+h key combination causes the error text referenced by aria-describedby to be read by VoiceOver.</li>
</ul>
</body>
</html>