Skip to content

bug(cdkTextareaAutosize): AutoResize doesn't scroll to cursor on Chrome #31874

@jlandsmann

Description

@jlandsmann

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 one has a textarea with the autoResize directive with e.g. 5 max rows and users enter more than 5 lines, the height of the textarea is limited correctly. But the cursor and the now written text is out of the viewport.

This problem occurs in Chrome. In Firefox the textarea scrolls to the cursor.

Image

Reproduction

The problem doesn't occur inside StackBlitz, but in the official documentation.

StackBlitz link:
https://stackblitz.com/edit/cdktextareaautosize-problem

Angular Material Docs:
https://material.angular.dev/cdk/text-field/overview#automatically-resizing-a-lesstextareagreater

Steps to reproduce:

  1. Use Chrome
  2. Write more than 5 lines inside the textarea

Expected Behavior

The textarea should scroll to the cursor, if the cursor would be outside of the viewport otherwise.

Actual Behavior

The textarea does not scroll automatically in Chrome browsers.

Environment

  • Angular: 19.2.4, 20.3.0
  • CDK/Material: 19.2.4, 20.2.3
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/text-field

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions