angular / angular/components

bug(CdkTextareaAutosize): Textarea does not scroll to active line

Offen
#31,871 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: cdk/text-field P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### Is this a regression?

- [x] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

18

### Description

Hello,

Is there currently a solution or planned fix for this issue?

As described in [issue 30841](https://github.com/angular/components/issues/30841)
, when using the textarea with cdkTextareaAutosize, the component does not automatically scroll to keep the cursor in view once the content exceeds the maxRows. This makes the textarea very difficult to use.

The problem occurs on Google Chrome (but not in Firefox).

It appeared starting from Angular Material v19.

In v18, the behavior was correct: https://v18.material.angular.dev/cdk/text-field/overview

From v19 up to the current version, the bug is reproducible in Chrome: https://material.angular.dev/cdk/text-field/overview

Thank you for your help and clarification.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/ozyjlswf?file=src%2Fexample%2Ftext-field-autosize-textarea-example.html
Steps to reproduce:
Using google Chrome:
1. start typing in the textarea (add lines pressing enter)
2. when more that 5 lines are added, cursor deapear and we are typing in the hidden part of the textarea (we don't see what we are typing anymore)

Do the same on Firefox:
- the textarea scrolls automatically to active line

### Expected Behavior

The textarea does not scroll automatically to the active line on google chrome

### Actual Behavior

The textarea should scroll automatically to the active line on all nagigators

### Environment

- Angular: 20
- CDK/Material: 20
- Browser(s): Google Chrome
- Operating System: Windows, macOS, Ubuntu

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduzieren Sie das Problem mithilfe des verlinkten StackBlitz-Beispiels in Chrome und vergleichen Sie anschließend das Verhalten mit Firefox sowie den Beispielen für Angular Material v18 und v20. Geben Sie mehr als fünf Zeilen in das textarea ein und überprüfen Sie, dass der Cursor während der Eingabe sichtbar bleibt; die Fehlerbehebung ist abgeschlossen, wenn Chrome wie Firefox zur aktiven Zeile scrollt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.