fix(aria): aria label/id updates

This commit is contained in:
Adam Bradley
2015-12-14 21:34:40 -06:00
parent 2a32711857
commit 7c8c56ee3e
7 changed files with 72 additions and 101 deletions

View File

@ -33,6 +33,7 @@ import {Form} from '../../util/form';
host: {
'role': 'checkbox',
'tappable': 'true',
'[attr.id]': 'id',
'[attr.tab-index]': 'tabIndex',
'[attr.aria-checked]': 'checked',
'[attr.aria-disabled]': 'disabled',
@ -53,7 +54,7 @@ import {Form} from '../../util/form';
export class Checkbox {
constructor(
form: Form,
private form: Form,
@Optional() ngControl: NgControl,
elementRef: ElementRef
) {
@ -72,7 +73,11 @@ export class Checkbox {
* @private
*/
ngOnInit() {
this.labelId = 'label-' + this.inputId;
if (!this.id) {
this.id = 'chk-' + this.form.nextId();
}
this.labelId = 'lbl-' + this.id;
}
/**