Skip to content

Input components (md-input, md-select, md-checkbox etc) aren't aligned in a flex container... #2124

Closed

Description

@jmcgoldrick

... without setting align-items: center

Updated Plunk: http://plnkr.co/edit/TgFy04UErh9Xhr0A4XzK?p=preview

md-input behaves differently to md-select (and at least md-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?

Activity

  1. dreweird commented on Dec 9, 2016

    @dreweird

    it's been 6 hours ago....
    I have to update my npm

  2. kara commented on Dec 9, 2016

    @kara
    Contributor

    Thanks for reporting! The various form components should definitely align. We'll need to figure out which baseline to standardize under. cc: @jelbourn.

  3. added
    P2
    on Dec 9, 2016
  4. DSoko2 commented on Jan 6, 2017

    @DSoko2

    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.

    spacing

    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.

  5. no-more commented on Feb 2, 2017

    @no-more

    Hi,

    This is a bit off topic, but why not using md-input-container for md-select ?
    It would be great to have a single entry point.
    Maybe this is stupid question and not possible at all due to constraints, but to me this looks more logic.

    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

  6. sumpton commented on Feb 2, 2017

    @sumpton

    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.

  7. tmburnell commented on Feb 7, 2017

    @tmburnell

    This might be related: besides the header not having the same height from the text ... the initial overall height is not the same.
    The standard input looks like it has the height of 50px and the select box is 30px.
    so after you fill in something there is no space between the top like the standard input
    image

  8. tmburnell commented on Feb 23, 2017

    @tmburnell

    Here is another example:
    image

    This uses material beta 2, and flex-layout beta 5

  9. EladBezalel commented on Mar 5, 2017

    @EladBezalel
    Member

    @jmcgoldrick do you mind update your plunker to make it work so i can investigate it further?

  10. jmcgoldrick commented on Mar 6, 2017

    @jmcgoldrick
    Author

    @EladBezalel see here: http://plnkr.co/edit/TgFy04UErh9Xhr0A4XzK?p=preview I've updated with some toggles for the common issues I have come across:

    • Placeholder alignment
    • Alignment in a flex-box
    • Issues with font-size

    Oh, and some bits to highlight some of the elements if it helps

  11. 55 remaining items

  12. dimabutenko commented on Oct 17, 2017

    @dimabutenko

    What about mat-checkbox? I can't to add this to mat-form-field. Thanks

  13. melroy89 commented on Mar 24, 2018

    @melroy89

    @dimabutenko Same issue. Strange that mat-checkbox can't be part of a mat-form-field right..

  14. vanmxpx commented on Apr 3, 2018

    @vanmxpx

    ::ng-deep .mat-form-field-prefix, ::ng-deep .mat-form-field-suffix { align-self: flex-end; }
    this fix issue for prefix and suffix

    image

    image

  15. kakins commented on May 16, 2018

    @kakins

    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?

    image

    <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>
  16. benelliott commented on May 16, 2018

    @benelliott
    Contributor

    @kakins How are the items aligned in the parent container? Can you post a StackBlitz repro?

  17. JessyParis commented on Oct 11, 2018

    @JessyParis

    Same issue than Kakins with Material 6.4.7
    image

            <table>
                <tr>
                    <td>
                        <mat-form-field>
                            <mat-select placeholder="Transporteurs" [formControl]="toppings" multiple>
                                <mat-option *ngFor="let EntiteList of entiteList" [value]="EntiteList.RefEntite">{{EntiteList.Libelle}}</mat-option>
                            </mat-select>
                        </mat-form-field>
                    </td>
                    <td>
                        <mat-form-field>
                            <input matInput placeholder="Filtre" #filter>
                        </mat-form-field>
                    </td>
                    <td>
                        <button mat-icon-button (click)="applyFilter(filter.value)"><mat-icon aria-label="Filter">search</mat-icon></button>
                    </td>
                </tr>
            </table>
    
  18. JessyParis commented on Oct 11, 2018

    @JessyParis

    But it is working well in flex container.
    image

            <div style="float: left; padding: 0px; margin: 0px;">
                <mat-form-field>
                    <mat-select placeholder="Transporteurs" [formControl]="toppings" multiple>
                        <mat-option *ngFor="let EntiteList of entiteList" [value]="EntiteList.RefEntite">{{EntiteList.Libelle}}</mat-option>
                    </mat-select>
                </mat-form-field>
                <mat-form-field>
                    <input matInput placeholder="Filtre" #filter>
                </mat-form-field>
                <button mat-icon-button (click)="applyFilter(filter.value)"><mat-icon aria-label="Filter">search</mat-icon></button>
            </div>
    
  19. GreedyA1 commented on Sep 4, 2019

    @GreedyA1

    any update on this one?

  20. Splaktar commented on Sep 6, 2019

    @Splaktar
    Contributor

    @GreedyA1 no, it was closed almost 2 years ago. If you are seeing a bug with the latest release, please open a new issue.

  21. angular-automatic-lock-bot commented on Oct 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  22. locked and limited conversation to collaborators on Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions