Skip to content

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

Open
@kseamon

Description

@kseamon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    GThis is is related to a Google internal issueP3An 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