Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radio buttons and checkboxes: label without a for #2222

Closed
avernet opened this issue May 9, 2015 · 2 comments
Closed

Radio buttons and checkboxes: label without a for #2222

avernet opened this issue May 9, 2015 · 2 comments

Comments

@avernet
Copy link
Collaborator

avernet commented May 9, 2015

We generate a label without a for, which is an issue per WCAG2 1.3.1 (A), reported as E885 by TotalValidator. As in the case of #2221, we "should" generate a fieldset, but it works to generate a span instead of a label, and the appropriate role="group | radiogroup" aria-labelledby="label" on the container. Note that for radio buttons we should generate radiogroup, for checkboxes just group.

@avernet
Copy link
Collaborator Author

avernet commented Oct 6, 2015

E.g. we'd like to have (corresponding jsBin):

    <span>
      <span id="my-label" class="xforms-label">Checkboxes</span>
      <span class="xforms-items" role="group" aria-labelledby="my-label">
        <label>
          <input id="my-checkbox-1" type="checkbox" value="0">
          <span>First choice</span>
        </label>
      </span>
    </span>

Changes:

  • Added attributes role="group | radiogroup" aria-labelledby="my-label" on the element with class xforms-select-appearance-full | xforms-select1-appearance-full.
  • Label generated using span instead label, and has id so it can be referenced by the container.

@avernet avernet self-assigned this Nov 13, 2015
@avernet avernet added this to the 4.11 milestone Nov 13, 2015
ebruchez added a commit that referenced this issue Nov 19, 2015
@avernet
Copy link
Collaborator Author

avernet commented Mar 24, 2016

For a discussion of whether using a aria-labelledby="…" (and in this case a role="group | radiogroup") is an acceptable alternative to using a <label for="…"> (in this case pointing to a <fieldset>), see Can an input be “labeled” with a aria-labelledby instead of a ?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant