components icon indicating copy to clipboard operation
components copied to clipboard

bug(mat-form-field): when using appearance="outline", input fields increases in height.

Open iosipov27 opened this issue 2 years ago • 5 comments

Is this a regression?

  • [X] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When using mat-form-field with appearance="outline", text input field increases in height after entering a text Reproduces on mobile devices with iOS 17+

Reproduction

Steps to reproduce:

  1. Open Safari 17 on a mobile device (it is the default browser for iOS 17)
  2. Open Angular Material Page at https://material.angular.io/components/form-field/overview
  3. Find Outline form field
  4. Enter any text. Probably need to clear the field and enter the text again.

Expected Behavior

The height of the field should be the same as the field without text image

Actual Behavior

The field height is different compared to the field without text image

Environment

  • Angular: 15-17
  • CDK/Material: 15-17
  • Browser(s): mobile Safari 17
  • Operating System iOS 17.1.2

iosipov27 avatar Dec 04 '23 12:12 iosipov27

I can reproduce it as well, although it's weird that it only happens on a device and not the simulator.

crisbeto avatar Dec 12 '23 12:12 crisbeto

I recently updated to iOS 17.3 and I can't reproduce the issue anymore. Can anybody else confirm if it's gone on their end?

crisbeto avatar Feb 01 '24 07:02 crisbeto

I recently updated to iOS 17.3 and I can't reproduce the issue anymore. Can anybody else confirm if it's gone on their end?

I can reproduce it on iOS 17.4

iosipov27 avatar Feb 01 '24 08:02 iosipov27

I was able to prevent this behavior by adding the following CSS:

.mdc-text-field--outlined .mat-mdc-form-field-infix,
.mdc-text-field--no-label .mat-mdc-form-field-infix {
  padding-bottom: unset !important;
}

I searched the repo for that class and it looks like it might be coming from https://github.com/angular/components/blob/8fab89229d3aad9109c5a22244f9f35ae3fc675f/src/material/form-field/_mdc-text-field-density-overrides.scss#L30

xryanmason avatar Feb 04 '24 20:02 xryanmason

I was able to prevent this behavior by adding the following CSS:

.mdc-text-field--outlined .mat-mdc-form-field-infix,
.mdc-text-field--no-label .mat-mdc-form-field-infix {
  padding-bottom: unset !important;
}

I searched the repo for that class and it looks like it might be coming from

https://github.com/angular/components/blob/8fab89229d3aad9109c5a22244f9f35ae3fc675f/src/material/form-field/_mdc-text-field-density-overrides.scss#L30

Works for me as a tempotrary solution. Thanks. iOS 17.4

iosipov27 avatar Feb 13 '24 13:02 iosipov27