Skip to content

fix(radio): unable to click to select button if text is marked #14967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/lib/radio/radio.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '../core/style/variables';
@import '../core/ripple/ripple';
@import '../core/style/vendor-prefixes';
@import '../../cdk/a11y/a11y';


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

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