Skip to content

Commit

Permalink
fix(checkbox, radio): Fix checkbox label not read in JAWS (#4610)
Browse files Browse the repository at this point in the history
* Fix checkbox label not read in JAWS

* use another way
  • Loading branch information
tinayuangao authored May 25, 2017
1 parent 97a9bdc commit 5c48949
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/lib/checkbox/checkbox.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<label class="mat-checkbox-layout" #label>
<label [attr.for]="inputId" class="mat-checkbox-layout" #label>
<div class="mat-checkbox-inner-container"
[class.mat-checkbox-inner-container-no-side-margin]="!_hasLabel()">
<input #input
Expand Down Expand Up @@ -36,6 +36,8 @@
</div>
</div>
<span class="mat-checkbox-label" #labelWrapper>
<!-- Add an invisible span so JAWS can read the label -->
<span style="display:none">&nbsp;</span>
<ng-content></ng-content>
</span>
</label>
18 changes: 10 additions & 8 deletions src/lib/radio/radio.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@
</div>

<input #input class="mat-radio-input cdk-visually-hidden" type="radio"
[id]="inputId"
[checked]="checked"
[disabled]="disabled"
[name]="name"
[attr.aria-label]="ariaLabel"
[attr.aria-labelledby]="ariaLabelledby"
(change)="_onInputChange($event)"
(click)="_onInputClick($event)">
[id]="inputId"
[checked]="checked"
[disabled]="disabled"
[name]="name"
[attr.aria-label]="ariaLabel"
[attr.aria-labelledby]="ariaLabelledby"
(change)="_onInputChange($event)"
(click)="_onInputClick($event)">

<!-- The label content for radio control. -->
<div class="mat-radio-label-content" [class.mat-radio-label-before]="labelPosition == 'before'">
<!-- Add an invisible span so JAWS can read the label -->
<span style="display:none">&nbsp;</span>
<ng-content></ng-content>
</div>
</label>

0 comments on commit 5c48949

Please sign in to comment.