components icon indicating copy to clipboard operation
components copied to clipboard

Input and select placeholders are not correctly placed

Open tomrcht opened this issue 9 years ago • 15 comments

Bug, feature request, or proposal:

bug

What is the expected behavior?

https://material.angular.io/components/input/overview https://material.angular.io/components/select/overview

What is the current behavior?

Select placeholder has a lot of empty space : chrome_2017-10-17_10-42-03 Input placeholder is missplaced: chrome_2017-10-17_10-41-38

What are the steps to reproduce?

Just create a mat-form-field with an input / a select inside, I followed the documentation exemples

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular CLI : 1.4.7 Angular core : 4.4.4 Angular material : 2.0.0-beta.12 OS : Windows 10 x64 / MacOs 10.13

Is there anything else we should know?

Tested on Chrome 61, I don't have this issue with the beta.8

tomrcht avatar Oct 17 '17 08:10 tomrcht

Which browser did you find this? Looks good for me on Opera 48, Chrome 61, and Firefox 56 on Pop_OS (built on Ubuntu) 17.10

baruchvlz avatar Oct 17 '17 10:10 baruchvlz

Oops, forgot that information. I tested it on Chrome 61

tomrcht avatar Oct 17 '17 10:10 tomrcht

Same issue with mat-select, I see a lot of empty space

<mat-form-field>
   <mat-select matInput
		placeholder="{{'pass.new.labels.enginetype' | translate }}"
		formControlName="engineType"> <mat-option 
		*ngFor="let engineType of engineTypes" [value]="engineType.value">
		{{ engineType.value }} </mat-option> </mat-select>
 </mat-form-field>

aceleghin avatar Oct 18 '17 16:10 aceleghin

@Kornhe you're seeing it on the docs site in Chrome 61? Or you're seeing it in your own application? Can you provide a reproduction?

@lippomano do you have any old workarounds that add custom styles to your mat-select? A lot of folks added some css workarounds to keep them consistent until they were aligned natively, which is now the case in beta.12.

willshowell avatar Oct 18 '17 18:10 willshowell

@willshowell No, I'm seeing it on my own application, sorry for the confusion. Here is the code :

  <mat-form-field color="accent">
    <mat-select formControlName="countMethod" placeholder="Mode de décompte">
      <mat-option *ngFor="let method of countMethods" [value]="method.value">{{ method.displayValue }}</mat-option>
    </mat-select>
  </mat-form-field>

This is included in a MatDialog, however, putting it outside does not fix the issue

tomrcht avatar Oct 18 '17 18:10 tomrcht

@Kornhe Are you positive you don't have any overriding css? As I mentioned in my last comment, lots of people added a workaround to align the input and select before it was handled natively. You may have forgotten about some global css you dropped in a while back.

If you're sure, then I don't think there's much the team will be able to do without a reproduction.

willshowell avatar Oct 18 '17 18:10 willshowell

@willshowell I'm 100% sure I don't have any css overriding it, I removed all my stylesheets but it gives me the same results.

The select is part of a <form> ... </form>, I don't know if this is an issue but I don't think

tomrcht avatar Oct 18 '17 18:10 tomrcht

I have the same issue.

anvial avatar Oct 20 '17 11:10 anvial

Can someone experiencing these issues please create a plunker or stackblitz demonstrating it?

mmalerba avatar Oct 20 '17 16:10 mmalerba

I had the same issue, and as @willshowell stated, there was still an old mat-select { margin-top: 30px; } Deleting my old workaround-line fixed it.

ghost avatar Oct 22 '17 12:10 ghost

@mmalerba : For the mat-select, @willshowell was right, I had a margin-top leaking on it, causing the spacing. However, the input placeholder is not affected by any css, I double checked for that.

tomrcht avatar Oct 22 '17 12:10 tomrcht

@Kornhe are you using angular 4.4.4 or higher? it contains a fix for a whitespace bug that affected the select placeholder

mmalerba avatar Oct 23 '17 16:10 mmalerba

@mmalerba Yup, but has I said, I fixed the select placeholder, however, I can't find a fix for the input placeholder. This issue appeared when I made the transition to Angular 4.4.4 and Angular Material beta 12

tomrcht avatar Oct 23 '17 19:10 tomrcht

In short, when you perform a transform on the mat-select, the placeholder doesn't stay attached to the box...

fiferjanis avatar Apr 10 '18 04:04 fiferjanis

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.