Skip to content

Commit 0326557

Browse files
committed
fix(material-experimental/mdc-select): fix long labels being incorrectly cut off
1 parent 029136e commit 0326557

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/material-experimental/mdc-select/select.scss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ $mat-select-arrow-size: 5px !default;
88
$mat-select-arrow-margin: 4px !default;
99
$mat-select-panel-max-height: 256px !default;
1010
$mat-select-placeholder-arrow-space: 2 * ($mat-select-arrow-size + $mat-select-arrow-margin);
11+
$leading-width: 12px !default;
12+
$scale: 0.75 !default;
1113

1214
// We base the select panel styling on top of MDC's menu styles and we
1315
// implement the trigger ourselves since MDC doesn't provide an equivalent.
@@ -116,3 +118,25 @@ $mat-select-placeholder-arrow-space: 2 * ($mat-select-arrow-size + $mat-select-a
116118
display: block;
117119
}
118120
}
121+
122+
// Our MDC form field implementation is based on the MDC text field which doesn't include styles
123+
// for select. The select specific styles are not present as they don't use their text field as a
124+
// container. Below are the styles to account for the select arrow icon at the end.
125+
.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-fill {
126+
.mdc-floating-label {
127+
max-width: calc(100% - #{$mat-select-placeholder-arrow-space});
128+
}
129+
.mdc-floating-label--float-above {
130+
max-width: calc(100% / #{$scale} - #{$mat-select-placeholder-arrow-space} / #{$scale});
131+
}
132+
}
133+
134+
.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-outline {
135+
.mdc-notched-outline__notch {
136+
max-width: calc(100% - 2 * (#{$mat-select-placeholder-arrow-space} + #{$leading-width}));
137+
}
138+
139+
.mdc-text-field--label-floating .mdc-notched-outline__notch {
140+
max-width: calc(100% - #{$leading-width} * 2);
141+
}
142+
}

0 commit comments

Comments
 (0)