Skip to content

Commit f05ca0a

Browse files
committed
fix: address feedback
1 parent efd238f commit f05ca0a

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
@@ -221,6 +221,7 @@ $mat-input-underline-disabled-background-image:
221221
top: 100%;
222222
width: 100%;
223223
margin-top: -$mat-input-wrapper-spacing;
224+
overflow: hidden; // prevents multi-line errors from overlapping the input
224225
}
225226

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

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