Skip to content

Commit bdd024f

Browse files
committed
fix(material-experimental/mdc-checkbox): remove extra a11y tree node for the <label/>
In the mdc checkbox component, moves the click handler on the label to its parent, the .mdc-checkbox. This removes the extra a11y tree node on the label and fixes TalkBack having an extra navigation stop (#14385). A11y tree before this commit. It has an un-necessary node, which coresponds to the `<label>` element. ``` - Generic - Checkbox, "Field A" - Textlabel, "Field A" ``` A11y tree with this commit applied ``` - Generic - Checkbox, "Field A" ``` fixes #14385
1 parent 317011e commit bdd024f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/material-experimental/mdc-checkbox/checkbox.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="mdc-form-field"
22
[class.mdc-form-field--align-end]="labelPosition == 'before'">
3-
<div #checkbox class="mdc-checkbox">
3+
<div #checkbox class="mdc-checkbox" (click)="$event.stopPropagation()">
44
<!-- Render this element first so the input is on top. -->
55
<div class="mat-mdc-checkbox-touch-target" (click)="_onClick()"></div>
66
<input #nativeCheckbox
@@ -37,9 +37,7 @@
3737
[matRippleDisabled]="disableRipple || disabled"
3838
[matRippleCentered]="true"></div>
3939
</div>
40-
<label #label
41-
[for]="inputId"
42-
(click)="$event.stopPropagation()">
40+
<label #label [for]="inputId">
4341
<ng-content></ng-content>
4442
</label>
4543
</div>

0 commit comments

Comments
 (0)