Skip to content

Instantly share code, notes, and snippets.

@cptvitamin
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cptvitamin/bf4b5f9afbfff3af9894 to your computer and use it in GitHub Desktop.
Save cptvitamin/bf4b5f9afbfff3af9894 to your computer and use it in GitHub Desktop.
suggestion for having a select menu as a child of a checkbox
<form>
<!-- I wrapped these two related controls in a div with role="group"
and an aria-labelledby that references the existing Heading" -->
<div role="group" aria-labelledby="verification-access-title">
<h3 id="verification-access-title" class="modal-section-title"><%= gettext('Verification Access') %></h3>
<div class="modal-section-content verification-access">
<!-- I converted the unordered list to divs -->
<div class="list-fields list-input">
<div class="field field-checkbox checkbox-cosmetic">
<input
type="checkbox"
id="verification-access-checkbox"
class="input input-checkbox"
name="verification-access"
value=""
<% if (hasVerificationRestrictions) { %> checked="checked" <% } %>
>
<label class="label" for="verification-access-checkbox">
<!-- I hid these icons from visual screen readers -->
<i class="icon fa fa-check-square-o input-checkbox-checked" aria-hidden="true"></i>
<i class="icon fa fa-square-o input-checkbox-unchecked" aria-hidden="true"></i>
<%- gettext("Must complete verification checkpoint") %>:
</label>
<!-- While the visible proximity implies the relationship between these
two controls, we need something programmatic, like this offscreen
label -->
<label class="sr" for="verification-partition-select">
<%= gettext('Verification checkpoint to be completed') %>
</label>
<select id="verification-partition-select">
<% for (var i = 0; i < verificationPartitions.length; i++) {
partition=verificationPartitions[i];
%>
<option
value="<%- partition.id %>"
<% if (partition.selected) { %> selected <% } %>
><%- partition.name %></option>
<% } %>
</select>
</div>
</div>
</div>
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment