-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathforms.html
177 lines (175 loc) · 7.76 KB
/
forms.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
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Forms Bookmarklet for Accessibility Testing</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
</head>
<body>
<p><a href="index.html"><span aria-hidden="true"><</span> Back to Bookmarklets for Accessibility Testing</a></p>
<h1>Forms Bookmarklet for Accessibility Testing</h1>
<p>Forms Bookmarklet for Accessibility Testing inserts a solid green outline around labels that have FOR attributes with ID matches, a dashed orange outline around labels with NO FOR attributes, a dotted red outline around labels with no FOR/ID match, a dashed red outline around inputs with no explicit (FOR/ID) labels, and a dotted red outline around inputs with NO ID attributes. <label> elements that have a FOR are wrapped with a <label for=""> indicator, if no FOR attribute they're wrapped in a <label NO FOR> indicator, if <label> has a FOR that does not match an existing ID it's wrapped in a <label NO ID MATCH> indicator. <fieldset> and <legend> are also shown. </p>
<h2>Installation</h2>
<p><a href="javascript:(function(){document.body.appendChild(document.createElement('script')).src='https://cdn.jsdelivr.net/gh/pauljadam/bookmarklets@master/forms.js';var iframes=document.getElementsByTagName('iframe');for(i=0;i<iframes.length;i++) {iframes[i].contentDocument.body.appendChild(document.createElement('script')).src='https://cdn.jsdelivr.net/gh/pauljadam/bookmarklets@master/forms.js';}})();">Forms Bookmarklet</a> (drag link to bookmarks bar)</p>
<h2>Test Content</h2>
<form name="form1" method="post" action="">
<p>
<label>Wrapped (Implicit)
<input type="text" name="wrapped" id="wrapped">
</label>
</p>
<p>
<label for="ForID">For/ID (Explicit)</label>
<input type="text" name="ForID" id="ForID">
</p>
<p>
<label for="textarea">textarea (explicit)</label>
<textarea name="textarea" id="textarea"></textarea>
</p>
<p>
<input type="checkbox" name="checkbox" id="checkbox">
<label for="checkbox">checkbox (explicit)</label>
</p>
<fieldset>
<legend>Fieldset/Legend Construct</legend>
<p>
<label>
<input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_0">
Checkbox 1.0</label>
<br>
<label>
<input type="checkbox" name="CheckboxGroup1" value="checkbox" id="CheckboxGroup1_1">
Checkbox 1.1</label>
</p>
</fieldset>
<fieldset>
<legend>radio group fieldset/legend</legend>
<p>
<label>
<input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_0">
Radio 1.0</label>
<br>
<label>
<input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_1">
Radio 1.1</label>
<br>
</p>
</fieldset>
<p>
<label for="selectmenu">select menu (explicit)</label>
<select name="selectmenu" id="selectmenu">
<option>item1</option>
<option>item2</option>
<option>item3</option>
<option>item4</option>
</select>
<input type="button" name="go_button" id="go_button" value="Go">
</p>
<p>
<label for="optgroup">select with optgroup</label>
<select name="tshirt" id="optgroup">
<option value="" selected="">Select a Women's or Men's Size:</option>
<optgroup label="Women's Sizes">
<option value="wxsmall">Extra Small</option>
<option value="wsmall">Small</option>
<option value="wmedium">Medium</option>
<option value="wlarge">Large</option>
</optgroup>
<optgroup label="Men's Sizes">
<option value="mmedium">Medium</option>
<option value="mlarge">Large</option>
<option value="mxlarge">Extra Large</option>
<option value="mxxlarge">Extra Extra Large</option>
</optgroup>
</select>
</p>
<p>non-label text
placed to above input<br>
<input>
</p>
<p>non-label text
placed to left of input
<input>
</p>
<p><label for="notHere">label text
placed to left of input with no existing for id match</label>
<input id="wrong">
</p>
<p>
<input>
non-label text
placed to right of input</p>
<p>
<p>
<input type="hidden" id="iamhidden">
input type=hidden with no label</p>
<p>
<input title="Title Attribute">
</p>
<p>
<input aria-label="aria-label attribute" aria-invalid="true">
</p>
<p>
<label for="password">Password *</label><br>
<input type="text" name="password" id="password" aria-describedby="password-error password-format" aria-required="true">
<span id="password-format">8 digits, 1 upper case, 1 number, 1 special character </span>
</p>
<p>
<label for="password">Password2 *</label><br>
<input type="text" name="password2" id="password2" aria-describedby="password2-error password2-format" aria-required="true" aria-invalid="true"><span id="password2-error">Please enter your password in the required format.</span>
<span id="password2-format">8 digits, 1 upper case, 1 number, 1 special character </span>
</p>
<p>
<label for="date-missing">Date</label><br>
<input type="text" name="date-missing" id="date-missing" aria-describedby="non-existent-id">
<span id="date-format">MM/DD/YYYY</span>
</p>
<p><input aria-labelledby="non-existent-id">I have no label</p>
<p><span id="lblby1">This message will self destruct in</span> <input id="lblby2" type="number" aria-labelledby="lblby1 lblby2 lblby3"> <span id="lblby3">seconds.</span>
<p>
<label><input type="radio" name="RadioGroup3" value="radio1" id="RadioGroup3_0"><a href="http://www.google.com">Radio Link 1</a> wrapped label</label>
<br>
<input type="radio" name="RadioGroup3" value="radio2" id="RadioGroup3_1" aria-labelledby="radio-aria-label"><span id="radio-aria-label"><a href="http://www.google.com">Radio Link 2</a> no label just aria</span>
</p>
<p><input type="checkbox" id="foo1"> <label for="foo1">I have read and understand the <a href="http://www.google.com">Terms of Service</a></label></p>
<input type="reset" value="Reset">
<input type="submit" name="button" id="button" value="Submit">
</form>
<h3>Outside Form Element</h3>
<p>
<label>
<input type="checkbox" name="outside-checkbox" id="outside-checkbox">
Outside Checkbox Wrapped</label>
</p>
<p>
<label>
<input type="radio" name="RadioGroup2" value="radio" id="RadioGroup2_0">
Outside Radio 1</label>
<br>
<label>
<input type="radio" name="RadioGroup2" value="radio" id="RadioGroup2_1">
Outside Radio 2</label>
<br>
</p>
<label>Orphaned Label</label><br><br>
<label for="orphan">Orphaned Label with FOR</label>
<h2>Bookmarklet Demo
<script type="application/javascript">
function loadJS(file) {
// DOM: Create the script element
var jsElm = document.createElement("script");
// set the type attribute
jsElm.type = "application/javascript";
// make the script element load file
jsElm.src = file;
// finally insert the element to the body element in order to load the script
document.body.appendChild(jsElm);
}
</script>
</h2>
<button onclick="loadJS('forms.js');">Show Forms Info</button>
<h4><a href="iosinstall.html">Not so easy installation method</a></h4>
<label for="jscode">Copy/Paste JavaScript Bookmarklet URL Code</label><br>
<textarea id="jscode" rows="4" cols="40">javascript:(function(){document.body.appendChild(document.createElement('script')).src='https://cdn.jsdelivr.net/gh/pauljadam/bookmarklets@master/forms.js';var iframes=document.getElementsByTagName('iframe');for(i=0;i<iframes.length;i++) {iframes[i].contentDocument.body.appendChild(document.createElement('script')).src='https://cdn.jsdelivr.net/gh/pauljadam/bookmarklets@master/forms.js';}})();</textarea>
</body>
</html>