-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Input components (md-input, md-select, md-checkbox etc) aren't aligned in a flex container... #2124
Comments
it's been 6 hours ago.... |
Thanks for reporting! The various form components should definitely align. We'll need to figure out which baseline to standardize under. cc: @jelbourn. |
I recognized that also the spacing between the selected/input text and the label is different for md-select and md-input. The screenshot below shows a md-input and a md-select with the spacing im referring to. I would really appreciate, if they would use the same spacing to improve homogeneity of the forms. Since I think, this aspect is related to the topic of this issue, I didn't open a new one. On https://material.io/guidelines/components/text-fields.html#text-fields-labels there are two definitions for that kind of spacing under Labels -> Specs. Actually, it seems to be that md-select implements the left one with 8dp space between label and text and md-input implements the right one with 4dp spacing. |
Hi, This is a bit off topic, but why not using md-input-container for md-select ? This could also be used to group radio button or checkbox in order to define a placeholder which looks exactly like md-input placeholder. Thanks |
Thank you for all this wonderful code. I am busy refactoring a ton of Bootstrap. On this mention of a common wrapper, I have been wishing for md-prefix and md-hint support across all of the form controls. For inputs I have enjoyed using md-prefix with md-icon together -- for example a search icon. |
@jmcgoldrick do you mind update your plunker to make it work so i can investigate it further? |
@EladBezalel see here: http://plnkr.co/edit/TgFy04UErh9Xhr0A4XzK?p=preview I've updated with some toggles for the common issues I have come across:
Oh, and some bits to highlight some of the elements if it helps |
Thanks for the explanation, @mmalerba. Just to add to the list of potential temporary solutions, I had to add a margin-bottom element to the mat-input-underline class in my custom CSS:
Note that >>> also worked in place of /deep/. After this new CSS was applied, the select and input lined up to the human eye. |
@tremaineeto Going forward it's recommended to use |
@sanka76811 The md-select placeholder and the value still don't align with the textbox. If only the solution was as simple. Hopefully this will be resolved soon when they overhaul the md-select control. |
https://github.com/Nathan-Ryan 100% correct. its temporary solution until total solution come up with md-select control. |
For some reason, none of the other suggestions worked for me. When using an .mat-select-placeholder{
font-size: 14px;
&.mat-floating-placeholder{
top: -16px !important;
}
}
.mat-select-trigger{
height: 27px !important;
} |
In my case, it occurred that md-select {
.mat-select-placeholder::before {
content: "\200b"; //zero-width space
}
} It's adding zero-width space (so don't display anything and don't occupy any space) before container for placeholder. The result is the same - browser successfully detects baseline of whole |
user this css is work fine for me `.mat-select-placeholder{ &.mat-floating-placeholder{ |
use this .mat-select-placeholder{
font-size: 14px;
&.mat-floating-placeholder{
top: -18px !important;
}
}
.mat-select-trigger{
height: 2.4vh !important;
min-height: 23px !important;
margin-bottom: 18px;
} |
This should be fixed now that both input and select go inside |
And it is, I confirm in beta 12 mat-select inside mat-form-field is aligned perfectly. |
What about mat-checkbox? I can't to add this to mat-form-field. Thanks |
@dimabutenko Same issue. Strange that mat-checkbox can't be part of a mat-form-field right.. |
I'm still seeing this issue, even with input and select wrapped in mat-form-field. I'm not sure if this is really resolved? <mat-form-field>
<input type="text" placeholder="Adloc"
[matChipInputFor]="adlocChips"
[matAutocomplete]="auto"
[matChipInputAddOnBlur]="addOnBlur"
matInput [formControl]="adlocSearch" #adlocInput/>
</mat-form-field> ... <mat-form-field>
<mat-select placeholder="Status" [(ngModel)]="positionFilter.isVacant" ng-change="updateFilter()">
<mat-option [value]="undefined">All</mat-option>
<mat-option [value]="false">Filled</mat-option>
<mat-option [value]="true">Vacant</mat-option>
</mat-select>
</mat-form-field> |
@kakins How are the items aligned in the parent container? Can you post a StackBlitz repro? |
any update on this one? |
@GreedyA1 no, it was closed almost 2 years ago. If you are seeing a bug with the latest release, please open a new issue. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
... without setting
align-items: center
Updated Plunk: http://plnkr.co/edit/TgFy04UErh9Xhr0A4XzK?p=preview
md-input
behaves differently tomd-select
(and at leastmd-checkbox
, possibly all the other "input" components) when the elements are within a "flex container"See this plunk for an example: http://plnkr.co/edit/aLXsp8MlV2AoOkC9aEFP?p=preview
This issue might be resolved with the in-progress refactor of input?
The text was updated successfully, but these errors were encountered: