angular / angular/components

bug(cdkTextareaAutosize): Autosize does not properly compute line heights when min-height or height is set via css

Open
#28,101 1 comment 2 reactions 0 assignees View on GitHub
area: cdk/text-field P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### 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

When `height` or `min-height` is set on a `textarea`, cdkTextareaAutosize does not properly calculate the line height.

I have a pull request ready to fix this issue, and will submit it shortly.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-mopjkj?file=src%2Fapp%2Fexample-component.css

### Expected Behavior

`height` and `min-height` should not affect the line height used to calculate the height based on min rows.

### Actual Behavior

`height` and `min-height` do affect the line height.

### Environment

- Angular: 16.2
- CDK/Material: 16.2
- Browser(s): Chrome (current)

Contributor guide

Open the contributing guide

Research direction

Start with the cdkTextareaAutosize implementation and reproduce the behavior using the linked StackBlitz example, especially its src/app/example-component.css. Verify how CSS height and min-height affect the calculated line height, then confirm that min-row sizing no longer uses those values.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.