Skip to content

Commit 4d9dcf0

Browse files
committed
fix(material/radio): Apply tokens at mixin root
Applies radio tokens at the theme mixin's root selector (or html if the mixin is called with no selector). This makes it easier for users to override tokens without worrying about specificity.
1 parent 06559a0 commit 4d9dcf0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/material/radio/_radio-theme.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@use '@material/radio/radio-theme' as mdc-radio-theme;
33
@use '@material/form-field' as mdc-form-field;
44
@use '../core/mdc-helpers/mdc-helpers';
5+
@use '../core/style/sass-utils';
56
@use '../core/theming/theming';
67
@use '../core/theming/inspection';
78
@use '../core/tokens/token-utils';
@@ -10,7 +11,7 @@
1011
@use '../core/tokens/m2/mat/radio' as tokens-mat-radio;
1112

1213
@mixin base($theme) {
13-
.mat-mdc-radio-button {
14+
@include sass-utils.current-selector-or-root() {
1415
@include mdc-radio-theme.theme(tokens-mdc-radio.get-unthemable-tokens());
1516
@include token-utils.create-token-values(
1617
tokens-mat-radio.$prefix, tokens-mat-radio.get-unthemable-tokens());
@@ -19,7 +20,7 @@
1920

2021
@mixin color($theme) {
2122
@include mdc-helpers.using-mdc-theme($theme) {
22-
.mat-mdc-radio-button {
23+
@include sass-utils.current-selector-or-root() {
2324
@include mdc-form-field.core-styles($query: mdc-helpers.$mdc-theme-styles-query);
2425
}
2526
}
@@ -46,7 +47,7 @@
4647
}
4748

4849
@mixin typography($theme) {
49-
.mat-mdc-radio-button {
50+
@include sass-utils.current-selector-or-root() {
5051
@include mdc-radio-theme.theme(tokens-mdc-radio.get-typography-tokens($theme));
5152
@include mdc-helpers.using-mdc-typography($theme) {
5253
@include mdc-form-field.core-styles($query: mdc-helpers.$mdc-typography-styles-query);
@@ -57,7 +58,7 @@
5758
@mixin density($theme) {
5859
$density-scale: inspection.get-theme-density($theme);
5960

60-
.mat-mdc-radio-button .mdc-radio {
61+
@include sass-utils.current-selector-or-root() {
6162
@include mdc-radio-theme.theme(tokens-mdc-radio.get-density-tokens($theme));
6263
}
6364

0 commit comments

Comments
 (0)