Skip to content

Commit e26670f

Browse files
crisbetoandrewseguin
authored andcommitted
fix(material-experimetal/mdc-form-field): account for breaking changes in MDC (#18795)
In material-components/material-components-web@8639c26 MDC reworked how their heights and paddings are set up, causing a compilation error on our end. These changes account for the new setup. (cherry picked from commit b2e8691)
1 parent 3b777eb commit e26670f

File tree

3 files changed

+520
-525
lines changed

3 files changed

+520
-525
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@types/youtube": "^0.0.38",
5656
"@webcomponents/custom-elements": "^1.1.0",
5757
"core-js": "^2.6.9",
58-
"material-components-web": "6.0.0-canary.17b9699c4.0",
58+
"material-components-web": "6.0.0-canary.d5808057f.0",
5959
"rxjs": "^6.5.3",
6060
"systemjs": "0.19.43",
6161
"tslib": "^1.10.0",

src/material-experimental/mdc-form-field/_mdc-text-field-structure-overrides.scss

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
border: none;
2828
}
2929

30-
// Reset the padding that MDC sets on native input elements. We cannot rely on this
31-
// spacing as we support arbitrary form-field controls which aren't necessarily matching
32-
// the "mdc-text-field__input" class. Note: We need the first selector to overwrite the
33-
// default no-label MDC padding styles which are set with a very high specificity.
30+
// Reset the height that MDC sets on native input elements. We cannot rely on their
31+
// fixed height as we handle vertical spacing differently. MDC sets a fixed height for
32+
// inputs and modifies the baseline so that the textfield matches the spec. This does
33+
// not work for us since we support arbitrary form field controls which don't necessarily
34+
// use an `input` element. We organize the vertical spacing on the infix container.
3435
.mdc-text-field--no-label:not(.mdc-text-field--textarea)
3536
.mat-mdc-input-element.mdc-text-field__input,
3637
.mat-mdc-text-field-wrapper .mat-mdc-input-element {
37-
padding: 0;
38+
height: auto;
3839
}
3940

4041
// MDC adds vertical spacing to inputs. We removed this spacing and intend to add it
@@ -77,12 +78,6 @@
7778
opacity: 1;
7879
}
7980

80-
// We removed the horizontal inset on input elements, but need to re-add the spacing to
81-
// the actual form-field flex container that contains the prefixes, suffixes and infix.
82-
.mat-mdc-text-field-wrapper .mat-mdc-form-field-flex {
83-
padding: 0 $mdc-text-field-input-padding;
84-
}
85-
8681
// Since we moved the horizontal spacing from the input to the form-field flex container
8782
// and the MDC floating label tries to account for the horizontal spacing, we need to reset
8883
// the shifting since there is no padding the label needs to account for. Note that we do not

0 commit comments

Comments
 (0)