Skip to content

bug(list): Hard to select text of mat-list-item line when having a title #26131

Closed
@MikaStark

Description

@MikaStark

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

14.x.x

Description

Since v15, It becomes very difficult to select the text of the matListItemLine just next to a matListItemTitle.
The title overlaps the lines (at least the first)

It's due to the margin-bottom: -20px; css property on .mdc-list-item--with-two-lines .mdc-list-item__primary-text, .mdc-list-item--with-three-lines .mdc-list-item__primary-text and the ::after/::before use.

Reproduction

Steps to reproduce:

  1. Go to https://material.angular.io/components/list/examples
  2. Scroll to the example "List variants"
  3. Try to double click on a mat list item line (see that the text is well selected)
  4. Click on the Stackblitz link of this example
  5. Try to double click on a mat list item line (see that the title is selected instead of the line text)

Expected Behavior

Same behavior on the doc website

Which seems to have been handled with this CSS code :

.mat-mdc-list-base .mdc-list-item__start,
.mat-mdc-list-base .mdc-list-item__end,
.mat-mdc-list-base .mdc-list-item__content {
    pointer-events: auto;
}

Of course we could add it by ourself on each project but I guess the actual behavior is more a bug than wanted

Actual Behavior

The title is selected instead of the line text

Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions