Skip to content

Commit a9d144a

Browse files
committed
fix: address feedback
1 parent c7e2d69 commit a9d144a

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

src/demo-app/input/input-demo.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ <h4>Regular</h4>
6464

6565
<md-input-container>
6666
<input mdInput placeholder="email" [formControl]="emailFormControl">
67-
<md-error *ngIf="emailFormControl.errors['required']">This field is required</md-error>
68-
<md-error *ngIf="emailFormControl.errors['pattern']">
67+
<md-error *ngIf="emailFormControl.errors ? emailFormControl.errors['required'] : false">
68+
This field is required
69+
</md-error>
70+
<md-error *ngIf="emailFormControl.errors ? emailFormControl.errors['pattern'] : false">
6971
Please enter a valid email address
7072
</md-error>
7173
</md-input-container>

src/lib/input/input-container.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<ng-content select="md-error, mat-error"></ng-content>
4242
</div>
4343

44-
<div *ngSwitchCase="'hint'" class="mat-input-hint-clearfix" [@transitionMessages]="_messageAnimationState">
44+
<div *ngSwitchCase="'hint'" [@transitionMessages]="_messageAnimationState">
4545
<div *ngIf="hintLabel != ''" [attr.id]="_hintLabelId" class="mat-hint">{{hintLabel}}</div>
4646
<ng-content select="md-hint, mat-hint"></ng-content>
4747
</div>

src/lib/input/input-container.scss

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ $mat-input-underline-disabled-background-image:
228228
top: 100%;
229229
width: 100%;
230230
margin-top: -$mat-input-wrapper-spacing;
231+
overflow: hidden; // prevents multi-line errors from overlapping the input
231232
}
232233

233234
// The hint is shown below the underline. There can be
@@ -249,19 +250,6 @@ $mat-input-underline-disabled-background-image:
249250
}
250251
}
251252

252-
// Clears the floats on the hints. Necessary for the `transform` animation to work.
253-
.mat-input-hint-clearfix {
254-
&::before,
255-
&::after {
256-
content: '';
257-
display: table;
258-
}
259-
260-
&::after {
261-
clear: both;
262-
}
263-
}
264-
265253
// Single errror message displayed beneath the input.
266254
.mat-input-error {
267255
display: block;

src/lib/input/input-container.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export class MdInputContainer implements AfterViewInit, AfterContentInit {
368368
}
369369

370370
/** Determines whether to display hints, errors or no messages at all. */
371-
_getDisplayedMessages(): 'error'|'hint'|'none' {
371+
_getDisplayedMessages(): 'error' | 'hint' | 'none' {
372372
if (this._errorChildren.length > 0) {
373373
if (this._isErrorState()) {
374374
return 'error';

0 commit comments

Comments
 (0)