Skip to content

fix(form-field): long labels and option values going under select arrow #14268

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

Merged
merged 1 commit into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 16 additions & 0 deletions src/lib/form-field/form-field-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@ select.mat-input-element {
}
}

.mat-input-element {
// The arrow is 2 * $arrow-size wide and we add one more width for some spacing.
$padding: $arrow-size * 3;
padding-right: $padding;

[dir='rtl'] & {
padding-right: 0;
padding-left: $padding;
}
}

// Ensure that long labels don't collide with the select arrow.
.mat-form-field-label-wrapper {
max-width: calc(100% - #{$arrow-size * 2});
}

&.mat-form-field-appearance-outline .mat-form-field-infix::after {
margin-top: -$arrow-size;
}
Expand Down
7 changes: 7 additions & 0 deletions src/lib/form-field/form-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ $mat-form-field-default-infix-width: 180px !default;
height: 100%;
overflow: hidden;
pointer-events: none; // We shouldn't catch mouse events (let them through).

[dir='rtl'] & {
// Usually this isn't necessary since the element is 100% wide, but
// when we've got a `select` node, we need to set a `max-width` on it.
left: auto;
right: 0;
}
}

// The label itself. This is invisible unless it is. The logic to show it is
Expand Down