ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: ion-input height and text alignment does not match Material design

Open sverdlov opened this issue 3 years ago • 5 comments

Prerequisites

Ionic Framework Version

  • [ ] v4.x
  • [ ] v5.x
  • [X] v6.x

Current Behavior

The alignment of input is incorrect. image

Expected Behavior

Expecting see correct behavior like in Material UI image Material Text Field

Steps to Reproduce

Just create project from scratch. Use following code

<ion-item mode='md' fill='outline'>
    <ion-label position='floating'>Login</ion-label>
    <ion-input></ion-input>
</ion-item>

Code Reproduction URL

No response

Ionic Info

Ionic CLI : 6.18.1 (/home/andrew/.nvm/versions/node/v14.17.3/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 6.0.3 @angular-devkit/build-angular : 13.0.4 @angular-devkit/schematics : 13.0.4 @angular/cli : 13.0.4 @ionic/angular-toolkit : 5.0.3

Additional Information

No response

sverdlov avatar Jan 24 '22 16:01 sverdlov

@sverdlov thanks for reporting this issue. After comparing the two design implementations, these are the immediate differences I have identified:

Item MD Ionic
Item height 56px 57px
Vertical input text alignment Center to container (~20px top/bottom) Undetermined (17px top/26px bottom)

Is there any other design issues you are noticing that you would like to include?

sean-perkins avatar Jan 24 '22 21:01 sean-perkins

Updating the title and tracking as a bug based on previous comment.

sean-perkins avatar Jan 26 '22 21:01 sean-perkins

Updating the title and tracking as a bug based on previous comment.

Any news on this? The text alignment inside the ion-input is clearly wrong when fill="outline" on the item. There is too much space at the bottom of the input image

enrique-lozano avatar May 05 '22 22:05 enrique-lozano

When do you plan to fix this issue because text alignment looks awful?

Yura13 avatar Sep 19 '22 10:09 Yura13

The team is actively working on two upcoming releases and has not prioritized this issue yet.

This repository is open source however and the alignment and height differences have been documented above. If this issue is a pain point for you and your application, we would gladly welcome a pull request that works to resolve this problem.

Thanks!

sean-perkins avatar Sep 19 '22 19:09 sean-perkins

By lowering the height of the field a bit you can get the text inside to be more or less centered:

.md .item-fill-outline {
  &::part(native) {
    height: 50px;
  }
}

It's probably not the best solution since the input really should be 56px following the Material Design specifications, but for now it does the trick for me. I'm waiting to see if the ionic team or someone else comes up with a better solution (I've tried to investigate the css further and I can't find any)

enrique-lozano avatar Sep 21 '22 22:09 enrique-lozano

Thanks for the report. In Ionic 7 we are introducing a new syntax for working with ion-input. This issue is fixed when using that new syntax. We will have an Ionic 7 beta in the future where developers can test and provide feedback. There will also be a migration guide to show how to update to the new input syntax.

The work required to resolve this has been completed, so I am going to close this thread. Let me know if there are any questions.

liamdebeasi avatar Jan 11 '23 21:01 liamdebeasi

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Feb 10 '23 22:02 ionitron-bot[bot]