Skip to content

List item sanity check uses wrong variable #27582

@RobertFlavia

Description

@RobertFlavia

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

I guess never

Description

In the sanity check of the list item base class there is the variable numLines which instead of using the number of lines actually uses the number of titles accidentally. You can see this here: https://github.com/angular/components/blob/03a773a0237843fd1e1e600d0b9911eb924319bc/src/material/list/list-base.ts#L329C9-L329C18

_titles must be replaced by _lines.

Reproduction

StackBlitz link: https://stackblitz.com/edit/angular-ex442q?file=src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.module.ts

Steps to reproduce:

  1. Just see the HTML, it adds 4 list item lines
  2. The sanity check usually should forbid more than 3 lines
  3. But as it uses the title count for the check, it still works

Expected Behavior

Use the number of lines instead of titles.
Number of lines is limited to 3.

Actual Behavior

Uses the number of titles for the line count check.
Number of lines is not limited.

Environment

  • Angular: any
  • CDK/Material: any
  • Browser(s): any
  • Operating System (e.g. Windows, macOS, Ubuntu): any

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functionsarea: material/list

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions