Skip to content

Commit 6a04753

Browse files
committed
use another way
1 parent c16e908 commit 6a04753

File tree

3 files changed

+36
-24
lines changed

3 files changed

+36
-24
lines changed

src/lib/checkbox/checkbox.html

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
<label [attr.for]="inputId" class="mat-checkbox-layout" #label>
22
<div class="mat-checkbox-inner-container"
33
[class.mat-checkbox-inner-container-no-side-margin]="!_hasLabel()">
4+
<input #input
5+
class="mat-checkbox-input cdk-visually-hidden" type="checkbox"
6+
[id]="inputId"
7+
[required]="required"
8+
[checked]="checked"
9+
[value]="value"
10+
[disabled]="disabled"
11+
[name]="name"
12+
[tabIndex]="tabIndex"
13+
[indeterminate]="indeterminate"
14+
[attr.aria-label]="ariaLabel"
15+
[attr.aria-labelledby]="ariaLabelledby"
16+
(change)="_onInteractionEvent($event)"
17+
(click)="_onInputClick($event)">
418
<div md-ripple class="mat-checkbox-ripple"
519
[mdRippleTrigger]="label"
620
[mdRippleDisabled]="_isRippleDisabled()"
@@ -21,22 +35,9 @@
2135
<div class="mat-checkbox-mixedmark"></div>
2236
</div>
2337
</div>
24-
2538
<span class="mat-checkbox-label" #labelWrapper>
39+
<!-- Add an invisible span so JAWS can read the label -->
40+
<span style="display:none">&nbsp;</span>
2641
<ng-content></ng-content>
2742
</span>
2843
</label>
29-
<input #input
30-
class="mat-checkbox-input cdk-visually-hidden" type="checkbox"
31-
[id]="inputId"
32-
[required]="required"
33-
[checked]="checked"
34-
[value]="value"
35-
[disabled]="disabled"
36-
[name]="name"
37-
[tabIndex]="tabIndex"
38-
[indeterminate]="indeterminate"
39-
[attr.aria-label]="ariaLabel"
40-
[attr.aria-labelledby]="ariaLabelledby"
41-
(change)="_onInteractionEvent($event)"
42-
(click)="_onInputClick($event)">

src/lib/checkbox/checkbox.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,13 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
418418
}
419419
}
420420

421+
.mat-checkbox-input {
422+
// Move the input to the bottom and in the middle.
423+
// Visual improvement to properly show browser popups when being required.
424+
bottom: 0;
425+
left: 50%;
426+
}
427+
421428
.mat-checkbox-ripple {
422429
position: absolute;
423430
left: -$_mat-checkbox-ripple-size;

src/lib/radio/radio.html

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,21 @@
1010
[mdRippleDisabled]="_isRippleDisabled()"
1111
[mdRippleCentered]="true"></div>
1212
</div>
13+
14+
<input #input class="mat-radio-input cdk-visually-hidden" type="radio"
15+
[id]="inputId"
16+
[checked]="checked"
17+
[disabled]="disabled"
18+
[name]="name"
19+
[attr.aria-label]="ariaLabel"
20+
[attr.aria-labelledby]="ariaLabelledby"
21+
(change)="_onInputChange($event)"
22+
(click)="_onInputClick($event)">
23+
1324
<!-- The label content for radio control. -->
1425
<div class="mat-radio-label-content" [class.mat-radio-label-before]="labelPosition == 'before'">
26+
<!-- Add an invisible span so JAWS can read the label -->
27+
<span style="display:none">&nbsp;</span>
1528
<ng-content></ng-content>
1629
</div>
1730
</label>
18-
<input #input class="mat-radio-input cdk-visually-hidden" type="radio"
19-
[id]="inputId"
20-
[checked]="checked"
21-
[disabled]="disabled"
22-
[name]="name"
23-
[attr.aria-label]="ariaLabel"
24-
[attr.aria-labelledby]="ariaLabelledby"
25-
(change)="_onInputChange($event)"
26-
(click)="_onInputClick($event)">

0 commit comments

Comments
 (0)