Skip to content

Commit 5396085

Browse files
martynhoyermckennapsean
authored andcommitted
Update test.html to be more compliant/accessible (#95)
* Fix to output checkbox groups properly as concatenated string * Add comments to JS * Update test.html to be more compliant/accessible - Give all inputs IDs to associate with labels - Proper checkbox/radio groups with fieldset/legend and labels for every input * Fix type on form ID/for association
1 parent adfa1f2 commit 5396085

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

test.html

+38-38
Original file line numberDiff line numberDiff line change
@@ -56,45 +56,45 @@ <h1>Test All Form and Input Elements</h1>
5656
<!--color-->
5757
<fieldset class="pure-group">
5858
<label for="color">Favourite Color: </label>
59-
<input type="color" name="color" />
59+
<input id="color" type="color" name="color" />
6060
</fieldset>
6161

6262
<!--radio button-->
6363
<fieldset class="pure-group">
6464
<label for="radio">Choose a Programming Language: </label>
65-
<input type="radio" name="radio" value="js" checked />Javascript
65+
<input id="radio" type="radio" name="radio" value="js" checked />Javascript
6666
</fieldset>
6767

6868
<!--radio group-->
6969
<fieldset class="pure-group">
70-
<label for="radio-group">OK, Now Really Choose:</label>
71-
<input type="radio" name="radio-group" value="js" />Javascript
72-
<input type="radio" name="radio-group" value="java" />Java
73-
<input type="radio" name="radio-group" value="c++" />C++
74-
<input type="radio" name="radio-group" value="python" checked />Python
75-
<input type="radio" name="radio-group" value="other" />Other
70+
<legend>OK, Now Really Choose:</legend>
71+
<input id="radio-group--javascript" type="radio" name="radio-group" value="js" /> <label for="radio-group--javascript">Javascript</label>
72+
<input id="radio-group--java" type="radio" name="radio-group" value="java" /> <label for="radio-group--java">Java</label>
73+
<input id="radio-group--cplusplus" type="radio" name="radio-group" value="c++" /> <label for="radio-group--cplusplus">C++</label>
74+
<input id="radio-group--python" type="radio" name="radio-group" value="python" checked /> <label for="radio-group--python">Python</label>
75+
<input id="radio-group--other" type="radio" name="radio-group" value="other" /> <label for="radio-group--other">Other</label>
7676
</fieldset>
7777

7878
<!--checkbox-->
7979
<fieldset class="pure-group">
8080
<label for="checkbox">What are you Most Comfortable With?</label>
81-
<input type="checkbox" name="checkbox" value="js" checked />Javascript
81+
<input id="checkbox" type="checkbox" name="checkbox" value="js" checked />Javascript
8282
</fieldset>
8383

8484
<!--checkboxes-->
8585
<fieldset class="pure-group">
86-
<label for="checkboxes">What are you Most Comfortable With?</label>
87-
<input type="checkbox" name="checkboxes" value="js" checked />Javascript
88-
<input type="checkbox" name="checkboxes" value="java" />Java
89-
<input type="checkbox" name="checkboxes" value="c++" />C++
90-
<input type="checkbox" name="checkboxes" value="python" checked />Python
91-
<input type="checkbox" name="checkboxes" value="other" checked />Other
86+
<legend>What are you Most Comfortable With?</legend>
87+
<input id="checkboxes--javascript" type="checkbox" name="checkboxes" value="js" checked /> <label for="checkboxes--javascript">Javascript</label>
88+
<input id="checkboxes--java" type="checkbox" name="checkboxes" value="java" /> <label for="checkboxes--java">Java</label>
89+
<input id="checkboxes--cplusplus" type="checkbox" name="checkboxes" value="c++" /> <label for="checkboxes--cplusplus">C++</label>
90+
<input id="checkboxes--python" type="checkbox" name="checkboxes" value="python" checked /> <label for="checkboxes--python">Python</label>
91+
<input id="checkboxes--other" type="checkbox" name="checkboxes" value="other" checked /> <label for="checkboxes--other">Other</label>
9292
</fieldset>
9393

9494
<!--menu-->
9595
<fieldset class="pure-group">
9696
<label for="menu">Try Again:</label>
97-
<select name="menu">
97+
<select id="menu" name="menu">
9898
<option selected>Javascript</option>
9999
<option>Java</option>
100100
<option>C++</option>
@@ -106,7 +106,7 @@ <h1>Test All Form and Input Elements</h1>
106106
<!--list-->
107107
<fieldset class="pure-group">
108108
<label for="list">And Again:</label>
109-
<select name="list" size="5">
109+
<select id="list" name="list" size="5">
110110
<option>Javascript</option>
111111
<option>Java</option>
112112
<option>C++</option>
@@ -118,7 +118,7 @@ <h1>Test All Form and Input Elements</h1>
118118
<!--datalist-->
119119
<fieldset class="pure-group">
120120
<label for="datalist">And Yet Again!:</label>
121-
<input list="progLang" name="datalist" value="C++" />
121+
<input id="datalist" list="progLang" name="datalist" value="C++" />
122122
<datalist id="progLang">
123123
<option value="Javascript">
124124
<option value="Java">
@@ -130,62 +130,62 @@ <h1>Test All Form and Input Elements</h1>
130130

131131
<!--date-->
132132
<fieldset class="pure-group">
133-
<label for="date"></label>
134-
<input type="date" name="date" value="2017-03-16" />
133+
<label for="date">Date</label>
134+
<input id="date" type="date" name="date" value="2017-03-16" />
135135
</fieldset>
136136

137137
<!--datetime-local-->
138138
<fieldset class="pure-group">
139-
<label for="datetime-local"></label>
140-
<input type="datetime-local" name="datetime-local" value="2017-03-16T23:59:59" />
139+
<label for="datetime-local">Datetime local</label>
140+
<input id="datetime-local" type="datetime-local" name="datetime-local" value="2017-03-16T23:59:59" />
141141
</fieldset>
142142

143143
<!--month-->
144144
<fieldset class="pure-group">
145-
<label for="month"></label>
146-
<input type="month" name="month" value="2017-10" />
145+
<label for="month">Month</label>
146+
<input id="month" type="month" name="month" value="2017-10" />
147147
</fieldset>
148148

149149
<!--number-->
150150
<fieldset class="pure-group">
151-
<label for="number"></label>
152-
<input type="number" name="number" value="3" />
151+
<label for="number">Number</label>
152+
<input id="number" type="number" name="number" value="3" />
153153
</fieldset>
154154

155155
<!--range-->
156156
<fieldset class="pure-group">
157-
<label for="range"></label>
158-
<input type="range" name="range" value="76" min="0" max="100" />
157+
<label for="range">Range</label>
158+
<input id="range" type="range" name="range" value="76" min="0" max="100" />
159159
</fieldset>
160160

161161
<!--search-->
162162
<fieldset class="pure-group">
163-
<label for="search"></label>
164-
<input type="search" name="search" value="Bing || Google || DuckDuckGo" />
163+
<label for="search">Search</label>
164+
<input id="search" type="search" name="search" value="Bing || Google || DuckDuckGo" />
165165
</fieldset>
166166

167167
<!--tel-->
168168
<fieldset class="pure-group">
169-
<label for="tel"></label>
170-
<input type="tel" name="tel" value="012-345-6789" />
169+
<label for="tel">Tel</label>
170+
<input id="tel" type="tel" name="tel" value="012-345-6789" />
171171
</fieldset>
172172

173173
<!--time-->
174174
<fieldset class="pure-group">
175-
<label for="time"></label>
176-
<input type="time" name="time" value="10:51:36" />
175+
<label for="time">Time</label>
176+
<input id="time" type="time" name="time" value="10:51:36" />
177177
</fieldset>
178178

179179
<!--url-->
180180
<fieldset class="pure-group">
181-
<label for="url"></label>
182-
<input type="url" name="url" value="https://github.com/dwyl/html-form-send-email-via-google-script-without-server" />
181+
<label for="url">URL</label>
182+
<input id="url" type="url" name="url" value="https://github.com/dwyl/html-form-send-email-via-google-script-without-server" />
183183
</fieldset>
184184

185185
<!--week-->
186186
<fieldset class="pure-group">
187-
<label for="week"></label>
188-
<input type="week" name="week" value="2017-W51" />
187+
<label for="week">Week</label>
188+
<input id="week" type="week" name="week" value="2017-W51" />
189189
</fieldset>
190190

191191
<!--hidden-->

0 commit comments

Comments
 (0)