angular / angular/components

perf(cdkTextareaAutosize): Skip height measurements when textarea value is empty

オープン
#24,210 コメント 0 件 リアクション 0 件 担当者 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

Calls to _measureScrollHeight, which trigger css layout, are not needed when there's nothing in the text field. In this case, simply set the height to 1 row (height of one line).

See internal CL 421826236 for more context.

### Reproduction

Steps to reproduce:
1. Bootstrap a textarea with cdkTextareaAutosize that has value of '' (empty)

### Expected Behavior

_measureScrollHeight() called only when there's a non-empty value.

### Actual Behavior

_measureScrollHeight() is called regardless of value.

### Environment

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

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

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

調査の方向性

cdkTextareaAutosize の実装から開始し、値が空の textarea を使って _measureScrollHeight のエントリポイントを追跡します。空の値では測定を行わず 1 行分の高さが使用され、空でない値では測定動作が維持されることを確認します。実装のテストの場所が特定できた場合は、関連するテストを追加または更新します。

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

評価

技術スタック
angular, typescript
領域
frontend, performance
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

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

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