Skip to content

bug(CdkTextareaAutosize): cdkAutosizeMinRows and cdkAutosizeMaxRows settings not working as expected #28786

@ddzingielewski

Description

@ddzingielewski

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

8.2

Description

Hi, Following first example in angular material docs: https://v15.material.angular.io/cdk/text-field/overview where settings are:
cdkAutosizeMinRows="1" cdkAutosizeMaxRows="5"

I can only provide 3 rows and component stops expanding showing inner scroll after 4 row input.

Reproduction

StackBlitz link: https://stackblitz.com/run?file=src%2Fapp%2Ftext-field-autosize-textarea-example.ts
Steps to reproduce:

  1. Set 5 rows inside textarea control

Expected Behavior

I would expect component to expand to 5 rows and show inner scroll after input of 6th row. I found that it worked as expected on some old version of angular: https://stackblitz.com/angular/pbadbpbgyog?file=app%2Ftext-field-autosize-textarea-example.css

Actual Behavior

Component stops expanding after 3rd row and on 4th shows inner scroll.

Environment

  • Angular: 15
  • CDK/Material: 15
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows Pro 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions