Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Associate for attribute in label elements with aria-label with input elements #612

Closed
ThomasBurleson opened this issue Nov 11, 2014 · 1 comment
Labels
a11y This issue is related to accessibility type: demos type: docs type: enhancement
Milestone

Comments

@ThomasBurleson
Copy link
Contributor

Consider usage scenario of a table with checkbox columns:

table-editor-disabled-checkboxes

<label for='<some-id>'></label>
<p> ipsum lorem </p>
<md-checkbox id='some-id' ng-model="isChecked"></md-checkbox>
<!-- or even using:
<md-input id='some-id' type=checkbox type='checkbox'>
-->

Since the md-input or md-checkbox element has an assigned id, first check for a md-label element with matching for attribute value before warning about the aria-label; otherwise inject the lookup value (if aria-label was not explicitly specified).

md-label - when a for attribute could potentially register the aria-label is a global lookup. So the input element search associated labels is NOT a DOM search.

@ThomasBurleson ThomasBurleson added type: enhancement type: demos type: docs a11y This issue is related to accessibility labels Nov 11, 2014
@ThomasBurleson ThomasBurleson added this to the 0.7 milestone Nov 11, 2014
@ThomasBurleson ThomasBurleson changed the title Support associate label for attribute for aria-label associates Support label for attribute to associate aria-label with input elements Nov 11, 2014
@ThomasBurleson ThomasBurleson changed the title Support label for attribute to associate aria-label with input elements Support for attribute in label elements to associate aria-label with input elements Nov 11, 2014
@ThomasBurleson ThomasBurleson changed the title Support for attribute in label elements to associate aria-label with input elements Associate for attribute in label elements with aria-label with input elements Nov 11, 2014
@marcysutton
Copy link
Contributor

@ThomasBurleson I made a test sandbox where we can try out attribute pairings. When we have a distribution channel for Material figured out, I'm moving these to Codepen. But, for now: http://plnkr.co/edit/WpVB5u8v6U2PiyOoMiNJ

In short, to associate a <label> with a non-native element like <md-checkbox>, we will have to do a few things:

  • Include aria-labelledby="label-id" on the Material component to be labeled. See aria-labelledby doc
  • Include a matching id on the label or other text element
  • Enable checkbox/input toggling from click or keypress on label to mimic native behavior

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11y This issue is related to accessibility type: demos type: docs type: enhancement
Projects
None yet
Development

No branches or pull requests

3 participants