Skip to content

Commit 81380d2

Browse files
crisbetommalerba
authored andcommittedFeb 4, 2019
fix(radio): unable to click to select button if text is marked (#14967)
Fixes not being able to select a radio button by clicking on it, if part of the text of the label is marked. Fixes #14753.
1 parent 011a0d0 commit 81380d2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/lib/radio/radio.scss

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import '../core/style/variables';
22
@import '../core/ripple/ripple';
3+
@import '../core/style/vendor-prefixes';
34
@import '../../cdk/a11y/a11y';
45

56

@@ -16,6 +17,10 @@ $mat-radio-ripple-radius: 20px;
1617
// Inner label container, wrapping entire element.
1718
// Enables focus by click.
1819
.mat-radio-label {
20+
// Disable text selection on the label itself, because having text selected
21+
// will prevent focus from reaching the label. Below we'll re-enable it only
22+
// for the label's content so that people can still select the text.
23+
@include user-select(none);
1924
cursor: pointer;
2025
display: inline-flex;
2126
align-items: center;
@@ -87,6 +92,9 @@ $mat-radio-ripple-radius: 20px;
8792

8893
// Text label next to radio.
8994
.mat-radio-label-content {
95+
// Re-enable text selection for the button's content since
96+
// we disabled it above in the `.mat-radio-label`.
97+
@include user-select(auto);
9098
display: inline-block;
9199
order: 0;
92100
line-height: inherit;

0 commit comments

Comments
 (0)
Please sign in to comment.