File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed 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
+ // Reduce the size of the native buttons in a date/time input,
16
+ // because they can increase the height of the input (see #13317).
17
+ & ::-webkit-inner-spin-button ,
18
+ & ::-webkit-calendar-picker-indicator ,
19
+ & ::-webkit-clear-button {
20
+ font-size : 0.75em ;
21
+ }
22
+
23
+ // Native datetime inputs have an element in the shadow DOM that makes them taller than
24
+ // other inputs. These changes reset the user agent styles to make them consistent.
25
+ // via https://8yd.no/article/date-input-height-in-safari
26
+ & ::-webkit-datetime-edit {
27
+ line-height : 1 ;
28
+ padding : 0 ;
29
+ margin-bottom : -2px ;
30
+ }
31
+ }
32
+ }
Original file line number Diff line number Diff line change 9
9
@use ' ./form-field-focus-overlay' ;
10
10
@use ' ./form-field-high-contrast' ;
11
11
@use ' ./form-field-native-select' ;
12
+ @use ' ./user-agent-overrides' ;
12
13
@use ' ./mdc-text-field-textarea-overrides' ;
13
14
@use ' ./mdc-text-field-structure-overrides' ;
14
15
33
34
@include form-field-focus-overlay .private-form-field-focus-overlay ();
34
35
@include form-field-native-select .private-form-field-native-select ();
35
36
@include form-field-high-contrast .private-form-field-high-contrast ();
37
+ @include user-agent-overrides .private-form-field-user-agent-overrides ();
36
38
37
39
// Host element of the form-field. It contains the mdc-text-field wrapper
38
40
// and the subscript wrapper.
You can’t perform that action at this time.
0 commit comments