File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ sass_library(
6262 "_form-field-subscript.scss" ,
6363 "_mdc-text-field-structure-overrides.scss" ,
6464 "_mdc-text-field-textarea-overrides.scss" ,
65+ "_user-agent-overrides.scss" ,
6566 ],
6667 deps = [
6768 "//:mdc_sass_lib" ,
Original file line number Diff line number Diff line change 1+ // Mixin that resets user agent styles to make the form field behave consistently.
2+ @mixin private-form-field-user-agent-overrides () {
3+ .mat-mdc-form-field-input-control {
4+ // Due to the native input masking these inputs can be slightly taller than
5+ // the plain text inputs. We normalize it by resetting the line height.
6+ & [type = ' date' ],
7+ & [type = ' datetime' ],
8+ & [type = ' datetime-local' ],
9+ & [type = ' month' ],
10+ & [type = ' week' ],
11+ & [type = ' time' ] {
12+ line-height : 1 ;
13+ }
14+
15+ // Native datetime inputs have an element in the shadow DOM that makes them taller than
16+ // other inputs. These changes reset the user agent styles to make them consistent.
17+ // via https://8yd.no/article/date-input-height-in-safari
18+ & ::-webkit-datetime-edit {
19+ line-height : 1 ;
20+ padding : 0 ;
21+ margin-bottom : -2px ;
22+ }
23+ }
24+ }
Original file line number Diff line number Diff line change 99@use ' ./form-field-focus-overlay' ;
1010@use ' ./form-field-high-contrast' ;
1111@use ' ./form-field-native-select' ;
12+ @use ' ./user-agent-overrides' ;
1213@use ' ./mdc-text-field-textarea-overrides' ;
1314@use ' ./mdc-text-field-structure-overrides' ;
1415
3334@include form-field-focus-overlay .private-form-field-focus-overlay ();
3435@include form-field-native-select .private-form-field-native-select ();
3536@include form-field-high-contrast .private-form-field-high-contrast ();
37+ @include user-agent-overrides .private-form-field-user-agent-overrides ();
3638
3739// Host element of the form-field. It contains the mdc-text-field wrapper
3840// and the subscript wrapper.
You can’t perform that action at this time.
0 commit comments