-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(material/form-field): inconsistent height for non-text inputs (#2…
…6941) Fixes that some non-text input variants were taller than the text ones. Fixes #26915. (cherry picked from commit 298cbaf)
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Mixin that resets user agent styles to make the form field behave consistently. | ||
@mixin private-form-field-user-agent-overrides() { | ||
.mat-mdc-form-field-input-control { | ||
// Due to the native input masking these inputs can be slightly taller than | ||
// the plain text inputs. We normalize it by resetting the line height. | ||
&[type='date'], | ||
&[type='datetime'], | ||
&[type='datetime-local'], | ||
&[type='month'], | ||
&[type='week'], | ||
&[type='time'] { | ||
line-height: 1; | ||
} | ||
|
||
// Native datetime inputs have an element in the shadow DOM that makes them taller than | ||
// other inputs. These changes reset the user agent styles to make them consistent. | ||
// via https://8yd.no/article/date-input-height-in-safari | ||
&::-webkit-datetime-edit { | ||
line-height: 1; | ||
padding: 0; | ||
margin-bottom: -2px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters