perf(cdkTextareaAutosize): Skip height measurements when textarea value is empty
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
### 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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Parti dall’implementazione di cdkTextareaAutosize e segui il punto di ingresso _measureScrollHeight usando un textarea il cui valore è vuoto. Verifica che i valori vuoti usino un’altezza di una riga senza misurazione, mentre i valori non vuoti mantengano il comportamento di misurazione; aggiungi o aggiorna il test pertinente se viene identificata la posizione del test dell’implementazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- frontend, performance
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100