Skip to content

Commit dbf5164

Browse files
crisbetojosephperrott
authored andcommitted
fix(radio): improved alignment for native validation messages (#13570)
1 parent ba0c820 commit dbf5164

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/lib/radio/radio.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@
1414

1515
<div class="mat-ripple-element mat-radio-persistent-ripple"></div>
1616
</div>
17-
</div>
1817

19-
<input #input class="mat-radio-input cdk-visually-hidden" type="radio"
20-
[id]="inputId"
21-
[checked]="checked"
22-
[disabled]="disabled"
23-
[tabIndex]="tabIndex"
24-
[attr.name]="name"
25-
[required]="required"
26-
[attr.aria-label]="ariaLabel"
27-
[attr.aria-labelledby]="ariaLabelledby"
28-
[attr.aria-describedby]="ariaDescribedby"
29-
(change)="_onInputChange($event)"
30-
(click)="_onInputClick($event)">
18+
<input #input class="mat-radio-input cdk-visually-hidden" type="radio"
19+
[id]="inputId"
20+
[checked]="checked"
21+
[disabled]="disabled"
22+
[tabIndex]="tabIndex"
23+
[attr.name]="name"
24+
[required]="required"
25+
[attr.aria-label]="ariaLabel"
26+
[attr.aria-labelledby]="ariaLabelledby"
27+
[attr.aria-describedby]="ariaDescribedby"
28+
(change)="_onInputChange($event)"
29+
(click)="_onInputClick($event)">
30+
</div>
3131

3232
<!-- The label content for radio control. -->
3333
<div class="mat-radio-label-content" [class.mat-radio-label-before]="labelPosition == 'before'">

src/lib/radio/radio.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,10 @@ $mat-radio-ripple-radius: 20px;
152152
opacity: 0;
153153
}
154154
}
155+
156+
.mat-radio-input {
157+
// Move the input in the middle and towards the bottom so
158+
// the native validation messages are aligned correctly.
159+
bottom: 0;
160+
left: 50%;
161+
}

0 commit comments

Comments
 (0)