File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 8
8
9
9
< table style ="width: 100% " cellspacing ="0 "> < tr >
10
10
< td >
11
- < md-input-container style ="width: 100% ">
11
+ < md-input-container style ="width: 100% " floatPlaceholder =" never " >
12
12
< input mdInput placeholder ="First name ">
13
13
</ md-input-container >
14
14
</ td >
Original file line number Diff line number Diff line change @@ -108,8 +108,17 @@ $mat-input-underline-height: 1px !default;
108
108
// Once the autofill is committed, a change event happen and the regular md-input-container
109
109
// classes take over to fulfill this behaviour.
110
110
// Assumes the autofill is non-empty.
111
- & :-webkit-autofill + .mat-input-placeholder-wrapper .mat-float {
112
- transition : none ;
111
+ & :-webkit-autofill + .mat-input-placeholder-wrapper {
112
+ // The input is still technically empty at this point, so we need to hide non-floating
113
+ // placeholders to prevent overlapping with the autofilled value.
114
+ .mat-input-placeholder {
115
+ display : none ;
116
+ }
117
+
118
+ .mat-float {
119
+ display : block ;
120
+ transition : none ;
121
+ }
113
122
}
114
123
115
124
// Note that we can't use something like visibility: hidden or
@@ -148,7 +157,6 @@ $mat-input-underline-height: 1px !default;
148
157
149
158
// Put ellipsis text overflow.
150
159
width : 100% ;
151
- display : block ;
152
160
white-space : nowrap ;
153
161
text-overflow : ellipsis ;
154
162
overflow : hidden ;
@@ -162,8 +170,13 @@ $mat-input-underline-height: 1px !default;
162
170
color $swift-ease-out-duration $swift-ease-out-timing-function ,
163
171
width $swift-ease-out-duration $swift-ease-out-timing-function ;
164
172
165
- & .mat-empty {
166
- cursor : text ;
173
+ // Hide the placeholder initially, and only show it when it's floating or the input is empty.
174
+ display : none ;
175
+
176
+ & .mat-empty ,
177
+ & .mat-float :not (.mat-empty ),
178
+ .mat-focused & .mat-float {
179
+ display : block ;
167
180
}
168
181
169
182
[dir = ' rtl' ] & {
You can’t perform that action at this time.
0 commit comments