Skip to content

bug(MatFormField): textarea can be reduce to a smaller height than it's content #30089

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

Open
1 task
gillerr opened this issue Nov 26, 2024 · 1 comment
Open
1 task
Labels
area: material/form-field P4 A relatively minor issue that is not relevant to core functions

Comments

@gillerr
Copy link

gillerr commented Nov 26, 2024

Is this a regression?

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

The previous version in which this bug was not present was

No response

Description

A textarea within a mat-form-field can be resized using the mouse. If its height is reduced to less than the height of a single line of text, a vertical scrollbar will appear, and the text within the textarea will become truncated. This occurs while the parent mat-form-field maintains a minimum height of 56px.

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-starter-wybpxw?file=src%2Findex.html,src%2Fmain.ts
Steps to reproduce:

  1. using the mouse, reduce the textarea height below 24pixels => a vertical scrollbar appears

This bug can also be reproduced on Material's documentation: https://material.angular.io/components/form-field/overview#form-field-overview

Expected Behavior

It should not be possible to reduce a textarea height below 24px, which represents a single line of text.

Actual Behavior

When a textarea height is reduced below 24px, a vertical scrollbar appears even though the parent mat-form-field keeps a minimal height of 56px.

I also noticed that when the textarea height is reduced from 28px to 27px, the text within the textarea is moved up by 1px. The same behavior can be observed down to 24px. I couldn't understand why this occurs and I'm not sure it is related to the height problem described above.

Environment

  • Angular: 18.2.8
  • CDK/Material: 18.2.8 (but could be reproduced on all versions of the Material documentation)
  • Browser(s): Edge 131.0.2903.51 / Chrome 130.0.6723.116
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows / Ubuntu
@gillerr gillerr added the needs triage This issue needs to be triaged by the team label Nov 26, 2024
@amysorto amysorto added P4 A relatively minor issue that is not relevant to core functions area: material/form-field and removed needs triage This issue needs to be triaged by the team labels Dec 17, 2024
@gillerr
Copy link
Author

gillerr commented Jan 6, 2025

For info, this is still relevant with Material 19

mistrykaran91 added a commit to mistrykaran91/components that referenced this issue Apr 9, 2025
When textarea is resized to small height it overlaps the content, this fix set's the min-height

Fixes angular#30089
mistrykaran91 added a commit to mistrykaran91/components that referenced this issue Apr 9, 2025
…tency

When textarea is resized to small height it overlaps the content, this fix set's the min-height

Fixes angular#30089
mistrykaran91 added a commit to mistrykaran91/components that referenced this issue Apr 9, 2025
…ea consistency

When textarea is resized to small height it overlaps the content, this fix set's the min-height

Fixes angular#30089
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/form-field P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
2 participants