Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(input): horizontal overflow in IE and Edge #2784

Merged
merged 8 commits into from
Feb 9, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/lib/input/input-container.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
<div class="md-input-infix" [class.md-end]="align == 'end'">
<ng-content selector="input, textarea"></ng-content>

<label class="md-input-placeholder"
[attr.for]="_mdInputChild.id"
[class.md-empty]="_mdInputChild.empty"
[class.md-focused]="_mdInputChild.focused"
[class.md-float]="floatingPlaceholder"
[class.md-accent]="dividerColor == 'accent'"
[class.md-warn]="dividerColor == 'warn'"
*ngIf="_hasPlaceholder()">
<ng-content select="md-placeholder"></ng-content>
{{_mdInputChild.placeholder}}
<span class="md-placeholder-required" *ngIf="_mdInputChild.required">*</span>
</label>
<span class="md-input-placeholder-wrapper">
<label class="md-input-placeholder"
[attr.for]="_mdInputChild.id"
[class.md-empty]="_mdInputChild.empty"
[class.md-focused]="_mdInputChild.focused"
[class.md-float]="floatingPlaceholder"
[class.md-accent]="dividerColor == 'accent'"
[class.md-warn]="dividerColor == 'warn'"
*ngIf="_hasPlaceholder()">
<ng-content select="md-placeholder"></ng-content>
{{_mdInputChild.placeholder}}
<span class="md-placeholder-required" *ngIf="_mdInputChild.required">*</span>
</label>
</span>
</div>

<div class="md-input-suffix"><ng-content select="[mdSuffix], [md-suffix]"></ng-content></div>
Expand Down
19 changes: 19 additions & 0 deletions src/lib/input/input-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ md-input-container {
font-size: 100%;
pointer-events: none; // We shouldn't catch mouse events (let them through).
z-index: 1;
padding-top: 1em;

// Put ellipsis text overflow.
width: 100%;
Expand Down Expand Up @@ -159,6 +160,24 @@ md-input-container {
}
}

// Used to hide the placeholder overflow on IE, since IE doesn't take transform into account when
// determining overflow.
.md-input-placeholder-wrapper {
position: absolute;
left: 0;
top: -1em;
width: 100%;
padding-top: 1em;
overflow: hidden;
pointer-events: none; // We shouldn't catch mouse events (let them through).

// Keeps the element height since the placeholder text is `position: absolute`.
&::after {
content: '\\00a0';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if its worth making this a separate class, seems potentially useful in other circumstances e.g. cdk-no-collapse or something

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not sure about it. In this case it's useful, but in others where there may be content in the element, it may end up pushing it.

}
}


// The underline is what's shown under the input, its prefix and its suffix.
// The ripple is the blue animation coming on top of it.
.md-input-underline {
Expand Down