Skip to content

Commit 6e6e44a

Browse files
committed
fix: address feedback
1 parent bf4cc46 commit 6e6e44a

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
@@ -61,8 +61,10 @@ <h4>Regular</h4>
6161

6262
<md-input-container>
6363
<input mdInput placeholder="email" [formControl]="emailFormControl">
64-
<md-error *ngIf="emailFormControl.errors['required']">This field is required</md-error>
65-
<md-error *ngIf="emailFormControl.errors['pattern']">
64+
<md-error *ngIf="emailFormControl.errors ? emailFormControl.errors['required'] : false">
65+
This field is required
66+
</md-error>
67+
<md-error *ngIf="emailFormControl.errors ? emailFormControl.errors['pattern'] : false">
6668
Please enter a valid email address
6769
</md-error>
6870
</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
@@ -220,6 +220,7 @@ $mat-input-underline-disabled-background-image:
220220
top: 100%;
221221
width: 100%;
222222
margin-top: -$mat-input-wrapper-spacing;
223+
overflow: hidden; // prevents multi-line errors from overlapping the input
223224
}
224225

225226
// The hint is shown below the underline. There can be
@@ -241,19 +242,6 @@ $mat-input-underline-disabled-background-image:
241242
}
242243
}
243244

244-
// Clears the floats on the hints. Necessary for the `transform` animation to work.
245-
.mat-input-hint-clearfix {
246-
&::before,
247-
&::after {
248-
content: '';
249-
display: table;
250-
}
251-
252-
&::after {
253-
clear: both;
254-
}
255-
}
256-
257245
// Single errror message displayed beneath the input.
258246
.mat-input-error {
259247
display: block;

src/lib/input/input-container.ts

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

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

0 commit comments

Comments
 (0)