angular / angular/components

perf(cdkTextareaAutosize): Allow custom LineHeight computation strategies

オープン
#24,211 コメント 3 件 リアクション 6 件 担当者 0 名 GitHub で見る
area: cdk/text-field G P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

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

_cacheTextareaLineHeight() runs at startup for every instance of cdkTextareaAutosize, despite the fact that for most applications, the line height value will be consistent and constant across the whole app, and frequently known at development time.

_cacheTextareaLineHeight() is a costly operation as it triggers css layout (measured at about 20ms per textarea in my app).

For most applications, it would be safe to compute the value only once and share between instances, and many other apps could just hardcode it.

See internal CL 421826236 for more context.

### Reproduction

Steps to reproduce:
1. Bootstrap multiple textareas with cdkTextareaAutosize

### Expected Behavior

Developer is able to override default behavior of doing costly measurements of text line height on every instance

### Actual Behavior

No mechanism to override default behavior of doing costly measurements of text line height on every instance

### Environment

- Angular: 13
- CDK/Material: 13
- Browser(s): All
- Operating System (e.g. Windows, macOS, Ubuntu): All

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by locating cdkTextareaAutosize and its _cacheTextareaLineHeight() entry point, then trace how each instance computes and stores line height. Review any nearby tests for autosize behavior. Done means the default behavior remains covered while applications can choose a custom computation strategy that avoids unnecessary per-instance layout measurement.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend, performance
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。